from newbie: how specify # of times to invoke a regex; conv tuple to string

Jeff Epler jepler at unpythonic.net
Wed Apr 21 08:44:16 EDT 2004


Instead of .findall(), you could use .finditer() and only consume a
few results.  Otherwise, you can write your own code to use the 2-arg
version of .search() to start at the first position after the end of
the previous match.

If you want to take the tuple
    t = ('e', '', '8', '.')
and get the string
    s = 'e8.'
you want
    s = ''.join(t)

Jeff




More information about the Python-list mailing list