In <[EMAIL PROTECTED]>, querypk wrote: > how do I convert > b is a string b = '(1,2,3,4)' to b = (1,2,3,4)
In [1]: b = '(1,2,3,4)' In [2]: b[1:-1] Out[2]: '1,2,3,4' In [3]: b[1:-1].split(',') Out[3]: ['1', '2', '3', '4'] In [4]: tuple(b[1:-1].split(',')) Out[4]: ('1', '2', '3', '4') Ooops, you wanted ints in there: In [5]: tuple(map(int, b[1:-1].split(','))) Out[5]: (1, 2, 3, 4) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list