FYI
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
Prior to Python 2.0 string-manipulation functionality was in the string
module.
Beginning with Python 2.0 string is a built-in type just like list or int.
The string module still around for backwards compatibility but acts mostly
as a front-end to the new string type.
The string methods that are deprecated and will probably be removed in 3.0
are those from the string module. The built-in string type will always be
part of the language.
Old Way: import string
a = "Line of 'text' with 'single' quotes"
b = string.replace(a,"'","")
New Way: b = "Line of 'text' with 'single' quotes".replace("'","")
--ajr
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Fri Mar 25 11:39:24 2005
This archive was generated by hypermail 2.1.8 : Fri Mar 25 2005 - 11:39:24 AKST