Python

Joined
May 11, 2016
Messages
31
Reaction score
0
I am entering into the mysteries of Python. I downloaded IDLE as an IDE. I am particularly interested in reading files, set up a small test file, and started trying in the shell. The file and IDLE.app are in the same folder, but when I type in f = open("entity_list.txt"), I get an "unable to find file" message.
 
Joined
Jan 25, 2017
Messages
1,266
Reaction score
100
try something like

f = open("entity_list.txt","r")

for text_line in f:
print(text_line, end="")

The last line should be indented cant't seem to get the formatting right.
 
Last edited:
Joined
Jan 25, 2017
Messages
1,266
Reaction score
100
Or you could try putting the path to the .txt file in the open statement.
This was mine.
f = open("/users/steve/desktop/entity_list.txt","r")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top