+ 4

Question In Python. What is "str" statement?

Where do we use the 'str' statement in Python?

19th May 2018, 4:12 AM
Om Shejul
Om Shejul - avatar
4 Respostas
+ 14
The str() function converts a non-string into a string e.g. print(2 * 5) outputs 10 print(2 * str(5)) outputs 55
19th May 2018, 7:58 AM
David Ashton
David Ashton - avatar
+ 15
str statement is "string" String literals inside triple quotes, """" or ''', can span multiple lines of text. Python strings are "immutable" which means they cannot be changed after they are created (Java strings also use this immutable style). A subtle but important behavior of str is that it works on None, the Python null value. It returns the string 'None'. You'll use this to your advantage in the info function, as you'll see shortly.
19th May 2018, 4:22 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
0
Thank You
19th May 2018, 4:43 AM
Om Shejul
Om Shejul - avatar
0
'str' is used for typecast a value to String
22nd May 2018, 10:07 AM
saikat datta
saikat datta - avatar