Ricardo,
Thanks for the tip on how to use maketrans. I was trying to
over-complicate things on my side.
The string module lives in 3.0 ... only the duplicate methods have been
removed.
Regards,
Malcolm
___
Tutor maillist - Tutor@python.org
http://mai
On 16/04/2008, Ricardo Aráoz <[EMAIL PROTECTED]> wrote:
> You just have to use maketrans with empty strings. If string is
> deprecated then I guess some other way of creating translation tables
> will be provided.
Most string.* functions are deprecated, because they've been moved to
methods of
> Malcolm Greene wrote:
>> What is the Pythonic way to remove specific chars from a string? The
>> .translate( table[, deletechars]) method seems the most 'politically
>> correct' and also the most complicated.
Why complicated?
import string
myStr = 'some text from which you want to delete some
At 01:39 PM 4/14/2008, Kent Johnson wrote:
Dick Moores wrote:
def sigDigits(n):
"""
Strips any real decimal (as string) to just its
significant digits,
then returns its length, the number of significant
digits.
Examples: "-345" -> "345" ->
3;
"3.000" -> "3000" -> 4
"0.0001
Dick Moores wrote:
> def sigDigits(n):
> """
> Strips any real decimal (as string) to just its significant digits,
> then returns its length, the number of significant digits.
> Examples: "-345" -> "345" -> 3;
> "3.000" -> "3000" -> 4
> "0.0001234" -> "1234" -> 4;
> "10.
At 12:04 PM 4/14/2008, Kent Johnson wrote:
Malcolm Greene wrote:
> What is the Pythonic way to remove specific chars from a string?
The
> .translate( table[, deletechars]) method seems the most
'politically
> correct' and also the most complicated.
Most 'correct' and also by far the fastest. This
"Malcolm Greene" <[EMAIL PROTECTED]> wrote
> What is the Pythonic way to remove specific chars from a string? The
> .translate( table[, deletechars]) method seems the most 'politically
> correct' and also the most complicated.
Assuming you have lots of different characters and not just
one to re
Malcolm Greene wrote:
> What is the Pythonic way to remove specific chars from a string? The
> .translate( table[, deletechars]) method seems the most 'politically
> correct' and also the most complicated.
Most 'correct' and also by far the fastest. This recipe makes it a bit
easier to use:
http: