What does str(...) do?

Emile van Sebille emile at fenx.com
Fri Feb 11 08:39:47 EST 2000


>>> print str.__doc__
str(object) -> string

Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

In other words, if your argument is in fact a string, str(x) does
nothing.  However, it does allow for a single technique to be used
to display a type or class variable.  

Emile van Sebille
emile at fenx.com
-------------------


----- Original Message ----- 
From: Peter Bittner <bittneph at aston.ac.uk>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Friday, February 11, 2000 5:36 AM
Subject: What does str(...) do?


> Hi there!
> 
> I've seen
> 
>     print '....' + str(text) + '...'
> 
> in some code (in a function definition).
> What does this 'str(...)' really do? - Is it absolutely necessary??
> 
> Peter
> 
> | Peter H. Bittner
> | International Student at Aston University
> | e-mail: bittneph at aston.ac.uk
> | web: http://beam.to/bimbo
> +--------------------------
> -- 
> http://www.python.org/mailman/listinfo/python-list
> 






More information about the Python-list mailing list