Re: Text conversion in python

From: Anthony Valentine <amv@akvalentine.com>
Date: Wed Mar 23 2005 - 19:08:09 AKST

This looks to be perfect! Thanks!

Anthony

Justin Dieters wrote:

> Python has a handy .replace() function for strings.
>
> For instance:
>
> a = "Line of 'text' with 'single' quotes"
> b = a.replace("'", "")
>
> b now contains the string "Line of text with single quotes"
>
> http://docs.python.org/lib/node107.html
> Be aware: most of the string methods are deprecated and will be
> removed in Python 3.0 - I'm not sure how you would do it in 3.0... :/
>
> Regards,
> Justin
>
>
> Anthony Valentine wrote:
>
>> Hello everyone!
>>
>> I am very new to python and cannot seem to figure out how to perform
>> a simple text substitution.
>>
>> I want to remove all single quotes from a line of text.
>>
>> In perl, I would use:
>> $var =~ s/'//g;
>>
>> Does anyone know how to do this in python?
>>
>> Thanks in advance!
>>
>> Anthony Valentine
>>
>>
>> ---------
>> To unsubscribe, send email to <aklug-request@aklug.org>
>> with 'unsubscribe' in the message body.
>>
>>
>>
>>
>

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Thu Mar 24 18:02:22 2005

This archive was generated by hypermail 2.1.8 : Thu Mar 24 2005 - 18:02:22 AKST