[Tutor] Tutor Digest, Vol 50, Issue 9
Gloom Demon
gloomdemon at gmail.com
Wed Apr 9 14:29:35 CEST 2008
Hello :-)
Can someone please explain to me ho can I find out how many elements are
there in one record of a list?
The problem is as follows:
I have a txt file from which I read data into Python.
The file looks something like this:
01 bla bla bla 23,15 2345,67
02 alb alb 2,4 890,1
03 bal bla alb lab 567,12345 87,45
....
I need to be able to discriminate the string parts from the numeric ones.
Since the number of words in the file can vary, I have to be able to
find out when they are finished
and when the floats come in
mystring[0]-> always integer
mystring[1]-> string (word)
mystring[1-X]-> last string (word)
mystring[X+1]-> always float
mystring[X+2]-> always float
it would have been nice if I could find out the total number of the fields
in one list record so that I could then adress them via a variable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080409/5cc78f6f/attachment.htm
More information about the Tutor
mailing list