Help with String Manipulation
wtanksle at dolphin.openprojects.net
Wed Jun 23 03:26:01 CEST 1999
On Wed, 23 Jun 1999 01:06:25 GMT, Doug Stanfield wrote:
>If you're new to Python it might seem like some magic in this:
>>>> testring = "This is an example"
>>>> testlist = map (ord, testring)
>>>> import array
>>>> finalstring = array.array('b', testlist).tostring()
Whew! Is there any reason to not use:
>>> x = list("This is an example.")
>>> import string
In other words, since a string is immutable, just convert the string to a
If you MUST be obscure, try this:
>>> x = map(None, "This is an example.")
This way you don't have to play with ordinals.
-William "Billy" Tanksley
Utinam logica falsa tuam philosophiam totam suffodiant!
:-: May faulty logic undermine your entire philosophy!
More information about the Python-list