P
peter leonard
Hi,
I having a problem with reading each line from a text file. For example, the
file is a text file named 'test.txt' with the following content :
line 1
line 2
line 3
line 4
line 5
The following script attempts to print out each line :
datafile ="C:\\Classifier\Data\\test.txt"
dataobject = open(datafile,"r")
while dataobject.readline() !="":
line = dataobject.readline()
print line
However, the output from this script is :
line 2
line 4
I'm sure this is a simple problem but I can't figure it after loking up
several reference books and web pages. Any help would be greatly
appreciated.
Regards
Peter
_________________________________________________________________
Want to check if your PC is virus-infected? Get a FREE computer virus scan
online from McAfee.
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
I having a problem with reading each line from a text file. For example, the
file is a text file named 'test.txt' with the following content :
line 1
line 2
line 3
line 4
line 5
The following script attempts to print out each line :
datafile ="C:\\Classifier\Data\\test.txt"
dataobject = open(datafile,"r")
while dataobject.readline() !="":
line = dataobject.readline()
print line
However, the output from this script is :
line 2
line 4
I'm sure this is a simple problem but I can't figure it after loking up
several reference books and web pages. Any help would be greatly
appreciated.
Regards
Peter
_________________________________________________________________
Want to check if your PC is virus-infected? Get a FREE computer virus scan
online from McAfee.
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963