[Baypiggies] importing variables into python namespace using argparse module

Aahz aahz at pythoncraft.com
Mon Sep 12 02:24:54 CEST 2011


On Wed, Sep 07, 2011, Abhishek Pratap wrote:
>
> def read_file(file):
>     """Read the first same and create a dictionary
>     """
>     fh1 = open(file,'r')
>     for line in fh1:
>         print line

Side note: you should avoid naming your variables the same as existing
built-in ones:

>>> file
<type 'file'>

Also please read PEP8 to learn how to correctly format your code:

http://www.python.org/dev/peps/pep-0008/
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you don't know what your program is supposed to do, you'd better not
start writing it."  --Dijkstra


More information about the Baypiggies mailing list