'string'.strip(chars)-like function that removes from the middle?
Terry Reedy
tjreedy at udel.edu
Mon Jun 16 20:13:19 EDT 2008
More information about the Python-list mailing list
Mon Jun 16 20:13:19 EDT 2008
- Previous message (by thread): 'string'.strip(chars)-like function that removes from the middle?
- Next message (by thread): 'string'.strip(chars)-like function that removes from the middle?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Cédric Lucantis wrote:
> I don't see any string method to do that
>>> 'abcde'.translate(str.maketrans('','','bcd'))
'ae'
I do not claim this to be better than all the other methods,
but this pair can also translate while deleting, which others cannot.
- Previous message (by thread): 'string'.strip(chars)-like function that removes from the middle?
- Next message (by thread): 'string'.strip(chars)-like function that removes from the middle?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list