Skip to content

Instantly share code, notes, and snippets.

@rberaldo
Created September 10, 2012 06:45
Show Gist options
  • Save rberaldo/3689282 to your computer and use it in GitHub Desktop.
Save rberaldo/3689282 to your computer and use it in GitHub Desktop.
That's my first exercise on I/O!
def createBook(title,author,year):
outFile = open('database.txt', 'wt')
outFile.write("[book]\n")
outFile.write("title: " + title + "\n")
outFile.write("author: " + author + "\n")
outFile.write("year: " + year + "\n")
outFile.close()
print("Welcome to Shellf!")
print("Answer the questions to add your book do the database.")
title = input("Title: ")
author = input("Author: ")
year = input("Year: ")
print("Adding book...")
createBook(title,author,year)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment