Hello all. I am a newbe to Python. I have tried to create a class, named ic0File.
Here is what I get when I use it (Python 3.1)
>>> import sys
>>> sys.path.append('/remote/us01home15/ldagan/python/')
>>> import ic0File
>>> a=ic0File.ic0File('as_client/nohpp.ic0')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ic0File.py", line 7, in __init__
print ("".join(self.lines))
NameError: global name 'infile' is not defined
The class code is:
class ic0File:
def __init__(self,filename):
self.infile = open(filename, 'r')
import sys
import re
self.lines=self.infile.readlines() #reading the lines
print ("".join(self.lines)
Thanks,