Input data from .txt file and object array problem
foolsmart2005 at gmail.com
Thu Mar 12 13:03:37 CET 2009
I want to input data by using pickle
First of all, I have a database.txt
The content is like:
AAA,BBB,CCC is Language name, and aaalink,bbblink,ccclink is their
I want to store data by using pickle. Meanwhile , I got a problem.
#I have created a class:
self.lname = lname #lname is the Language
self.tlink = tlink #tlink is the tutorial link
self.alink = alink #alink is the a link to school Library finding
the first returned Language book
self.alink = alink
self.tlink = tlink
self.lname = lname
string = "+++++++++++++++" + \
"+" + lname \
"+" + tlink \
"+" + alink \
fo = ("/database.txt","r+")
lines = fo.readlines()
for line in lines:
pair = line.split(",")
temp = Lang();
temp.lname = pair
temp.tlink = pair
temp.alink = findbook(temp.lname)
#stopping here, because I don't know how to do here...
#I want to use object array here...
#Then using pickle to dump the object...
# Is this work? Or there is another better method to do so?
I hope to create an object array to store all the language and its
information from database.txt.
How can I do that? I am a beginner to Python. Any help would be
More information about the Python-list