str Function : str « Buildin Function « Python






str Function

str Function
# The str function coerces data into a string. 

# Every datatype can be coerced into a string.

str(1)                                             

horsemen = ['war', 'pestilence', 'famine'] 
print horsemen 

horsemen.append('Powerbuilder') 

print str(horsemen)                                     

           
       








Related examples in the same category

1.Why Use str on a doc string?Why Use str on a doc string?
2.Used by print: user-friendly formUsed by print: user-friendly form
3.Input and Output: str() function: return representations of values which are human-readableInput and Output: str() function: return representations of values which are human-readable