>> >> Here are some fixes >> >> filename is a variable and hence should not be in quotes. >> file_ is then called ‘f’ on the next line. >> The indenting is a bit wrong but this may just be your email. >> >> the line read_data … should be followed by something that appends the >> read_data to “object” which should be declared earlier. >> >>> On 19 Apr 2018, at 09:45, Niharika Jakhar <niharika1...@gmail.com >>> <mailto:niharika1...@gmail.com>> wrote: >>> >>> Hi >>> I want to store a file from BioGRID database (tab separated file, big data) >>> into a data structure(I prefer lists, please let me know if another would >>> be better) and I am trying to print the objects. >>> Here’s my code: >>> class BioGRIDReader: >>> def __init__(self, filename): >>> with open('filename', 'r') as file_: >>> read_data = f.read() >>> for i in file_ : >>> read_data = (i.split('\t')) >>> return (objects[:100]) >>> >>> a = BioGRIDReader >>> print (a.__init__(test_biogrid.txt)) >>> >>> >>> >>> >>> Here's what the terminal says: >>> Traceback (most recent call last): >>> File "./BioGRIDReader.py", line 23, in <module> >>> print (a.__init__(test_biogrid.txt)) >>> NameError: name 'test_biogrid' is not defined >>> >>> The file named test_biogrid.txt do exist in the same folder as this program. >>> >>> I am unable to go further with this code. Kindly help me out. >>> >>> >>> Thanks and regards >>> NIHARIKA >>> _______________________________________________ >>> Tutor maillist - Tutor@python.org <mailto:Tutor@python.org> >>> To unsubscribe or change subscription options: >>> https://mail.python.org/mailman/listinfo/tutor >>> <https://mail.python.org/mailman/listinfo/tutor> >> >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor