import os
# This program has read/write access to the WORKSPACE directory
filepath = os.path.join( os.environ['WORKSPACE'], 'books.txt' )
file = open(filepath, 'w')
books_data = []
for i in range(10):
print('%i/10. Input please...' % (i+1))
title = input('title of the book: ')
name = input('first name of the author: ')
surname = input('last name of the author: ')
books_data.append('%s\n%s\n%s' % (
title.upper(), surname.title(), name.title()))
print()
file.write(('\n\n').join(books_data))
file.close()
with open(filepath, 'r') as f:
f = f.read()
for book in f.split('\n\n'):
print('%s\t%s, %s' % tuple(book.split('\n')))
Comments
Dear visitor, please use panel for submitting new questions
After for i in range, why are their weird symbols after the print command?
Leave a comment