Newbie: How to convert "<" to "<" ( encoding? )
Bjorn Pettersen
bjorn at roguewave.com
Tue Oct 3 18:05:51 EDT 2000
This should get you going:
Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import string
>>> s = "this <is> a <string> with <nested <brackets>>"
>>> print string.replace.__doc__
replace (str, old, new[, maxsplit]) -> string
Return a copy of string str with all occurrences of substring
old replaced by new. If the optional argument maxsplit is
given, only the first maxsplit occurrences are replaced.
>>> tmp = string.replace(s, '<', '<')
>>> tmp
'this <is> a <string> with <nested <brackets>>'
>>> s = string.replace(tmp, '>', '>')
>>> s
'this <is> a <string> with <nested <brackets>>'
>>>
-- bjorn
Eric wrote:
>
> Hello all,
> The subject says it all. I'm sure there's a Python function that will
> convert:
> "<" to "<"
> ">" to ">"
> etc.
> Do you know what the function(s) is/are? Any help or pointers are greatly
> appreciated!
>
> Eric.
>
> --
> http://www.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list