[Solved] How can I produce a file? [closed]


The answers in the comments are more pythonic, but if you want a more easily understandable example

>>> books = {}
>>> line = "Calculus | James Stewart"
>>> parts = line.split('|') # can also do title, author = line.split('|')
>>> books[parts[0].strip()] = parts[1].strip()
>>> print(books)
{'Calculus': 'James Stewart'}

1

solved How can I produce a file? [closed]