I got a text file and saved it in python25 (a folder) as .txt. I need to import this file and I am getting syntax error that file is not defined. I am a complete biology novice to defining and importing files. Please help!

Recommended Answers

All 2 Replies

If you dont read the link;

yourfile = open('yourfilename.txt','r')
# r stands for read
yourtext = yourfile.readlines()
print yourtext
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.