[EMAIL PROTECTED] wrote: > Hi, > I have a bunch of strings like > a53bc_531.txt > a53bc_2285.txt > ... > a53bc_359.txt > > and I want to extract the numbers 531, 2285, ...,359. > > One thing for sure is that these numbers are the ONLY part that is > changing; all the other characters are always fixed.
In that case a fixed slice will do what you want: In [1]: s='a53bc_531.txt' In [2]: s[6:-4] Out[2]: '531' Kent -- http://mail.python.org/mailman/listinfo/python-list