[Tutor] help with regular expressions

Jeff Peery jeffpeery at yahoo.com
Wed Jun 30 00:29:20 EDT 2004

hello I am having trouble with using the re module. I have a statement:
line = FileHandle.readline(-1)
test = findall('\d', line)
where "line" is a line of text from a file I would like to read and extract numbers from. the line is simply three numbers, example 3.444456    4   84.3546354.  I want to put these number in "test" but the findall expression seems to only take whole numbers, so for example test would be for the above numbers [3, 4, 4, 4, 4, 5, 6, 4, 8, ....].  How is this done so that test = [3.444456    4   84.3546354]?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040629/194bfb45/attachment.html

More information about the Tutor mailing list