Is there a built-in fuction can convert any type of variable to string?
Curtis Jensen
cjensen at bioeng.ucsd.edu
Thu Jan 31 16:36:41 EST 2002
Ricky wrote:
> I have tried it. Thank you!
> "Aahz Maruch" <aahz at panix.com> wrote in message
> news:a2s6i9$858$1 at panix2.panix.com...
>
>>In article <a2s5mj$13vqrs$1 at ID-12869.news.dfncis.de>,
>>Ricky <store_li at sina.com> wrote:
>>
>>>I look around python reference guide, but can't find a function which can
>>>convert any type of variable to string type?
>>>
>>>Is there any one or not?
>>>
>>str()
>>
>>Look in the Library Reference under "built-in functions".
>>--
str() may not work as desired for all types. It is fairly uninformative
for instance types. If you want to convert ANY type of variable (and
preserve the information) you might want to look at pickle or
XML_pickle. Both will convert MOST types to a string. XML_Pickle will
be more readable.
--
Curtis Jensen
cjensen at bioeng.ucsd.edu
http://www-bioeng.ucsd.edu/~cjensen/
FAX (425) 740-1451
More information about the Python-list
mailing list