Best I can come up with:<br><br>>>> def split_number(string):<br>...     output = [string[0]]<br>...     for character in string[1:]:<br>...         if character.isdigit() != output[-1].isdigit():<br>...             output.append('')<br>

...         output[-1] += character<br>...     return tuple(output)<br>...     <br>>>> split_number('si_pos_99_rep_1_0.ita')<br>('si_pos_', '99', '_rep_', '1', '_', '0', '.ita')<br>

<br>Cheers,<br>Xav<br><br><div class="gmail_quote">On Fri, Apr 2, 2010 at 8:12 PM, Thomas Heller <span dir="ltr"><<a href="mailto:theller@ctypes.org">theller@ctypes.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Maybe I'm just lazy, but what is the fastest way to convert a string<br>
into a tuple containing character sequences and integer numbers, like this:<br>
<br>
<br>
'si_pos_99_rep_1_0.ita'  -> ('si_pos_', 99, '_rep_', 1, '_', 0, '.ita')<br>
<br>
Thanks for ideas,<br>
Thomas<br>
<font color="#888888"><br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>