Wednesday, August 6, 2014

How to save to a text file in Python

Saving to a text file can be very useful when database access is restricted and data needs to be saved.

In Python, this can be accomplished with just a few lines of code.

file = open('MyText.txt','w')
file.write("Name\nAddress\n")
file.close()


Now, if you check the file directory, your file will be there.

Check out my car app for iPhone in the iTunes App Store

No comments:

Post a Comment