Discussion on some Code Issues
rosuav at gmail.com
Sun Jul 8 10:03:25 CEST 2012
On Sun, Jul 8, 2012 at 3:42 PM, <subhabangalore at gmail.com> wrote:
> Thanks for pointing out the mistakes. Your points are right. So I am trying to revise it,
> for line in file_open:
> print (line_word)
Yep. I'd be inclined to rename file_open to something that says what
the file _is_, and you may want to look into the 'with' statement to
guarantee timely closure of the file, but that's a way to do it.
Also, as has already been mentioned: keeping your data files in the
Python binaries directory isn't usually a good idea. More common to
keep them in the same directory as your script, which would mean that
you don't need a path on it at all.
More information about the Python-list