[EMAIL PROTECTED] wrote:
Shakir,

I have thousands of records in MS Access database table, which records I
am fetching using python script. [A] columns has strings like '8 58-2155-58'
Desired output: '858215558'
input = '8 58-2155-58'
output = ''.join( [ c for c in input if c not in ' -' ] )
output
'858215558'

If you are planning to do a lot of strings:

    identity_trans = ''.join(chr(x) for x in range(256))

Then you can do simply:
    input = '8 58-2155-58'
    output = input.translate(identity_trans, ' -')

--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to