Terry Reedy wrote:
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.
You should
In article [EMAIL PROTECTED],
Peter Otten [EMAIL PROTECTED] wrote:
Terry Reedy wrote:
'abcde'.translate(str.maketrans('','','bcd'))
'ae'
You should mention that you are using Python 3.0 ;)
The 2.5 equivalent would be
uabcde.translate(dict.fromkeys(map(ord, ubcd)))
u'ae'
Only if you're
Sion Arrowsmith wrote:
In article [EMAIL PROTECTED],
Peter Otten [EMAIL PROTECTED] wrote:
Terry Reedy wrote:
'abcde'.translate(str.maketrans('','','bcd'))
'ae'
You should mention that you are using Python 3.0 ;)
The 2.5 equivalent would be
uabcde.translate(dict.fromkeys(map(ord, ubcd)))
Peter Otten wrote:
Terry Reedy wrote:
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.
Ethan Furman wrote:
Greetings.
The strip() method of strings works from both ends towards the middle.
Is there a simple, built-in way to remove several characters from a
string no matter their location? (besides .replace() ;)
For example:
.strip -- 'www.example.com'.strip('cmowz.')
'example'
Peter Otten schreef:
Ethan Furman wrote:
The strip() method of strings works from both ends towards the middle.
Is there a simple, built-in way to remove several characters from a
string no matter their location? (besides .replace() ;)
identity = .join(map(chr, range(256)))
Or
identity =
Greetings.
The strip() method of strings works from both ends towards the middle.
Is there a simple, built-in way to remove several characters from a
string no matter their location? (besides .replace() ;)
For example:
.strip -- 'www.example.com'.strip('cmowz.')
'example'
.??? -- ---
On Jun 16, 2008, at 12:58 PM, Ethan Furman wrote:
Greetings.
The strip() method of strings works from both ends towards the middle.
Is there a simple, built-in way to remove several characters from a
string no matter their location? (besides .replace() ;)
For example:
.strip --
Hi,
Greetings.
The strip() method of strings works from both ends towards the middle.
Is there a simple, built-in way to remove several characters from a
string no matter their location? (besides .replace() ;)
For example:
.strip -- 'www.example.com'.strip('cmowz.')
'example'
.??? --
Ethan Furman wrote:
Greetings.
The strip() method of strings works from both ends towards the middle.
Is there a simple, built-in way to remove several characters from a
string no matter their location? (besides .replace() ;)
For example:
.strip -- 'www.example.com'.strip('cmowz.')
'example'
Le Monday 16 June 2008 18:58:06 Ethan Furman, vous avez écrit :
The strip() method of strings works from both ends towards the middle.
Is there a simple, built-in way to remove several characters from a
string no matter their location? (besides .replace() ;)
For example:
.strip --
Ethan Furman wrote:
The strip() method of strings works from both ends towards the middle.
Is there a simple, built-in way to remove several characters from a
string no matter their location? (besides .replace() ;)
identity = .join(map(chr, range(256)))
'www.example.com'.translate(identity,
On Jun 16, 10:09 am, Peter Otten [EMAIL PROTECTED] wrote:
Ethan Furman wrote:
The strip() method of strings works from both ends towards the middle.
Is there a simple, built-in way to remove several characters from a
string no matter their location? (besides .replace() ;)
identity =
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.
--
14 matches
Mail list logo