0
What dose “str” mean???
8 ответов
+ 8
You can add two numbers like this: 5 + 5 = 10
You can concatenate two strings like this: 'hello ' + 'world'
But you can't add a string and an integer: 'hello' + 123 # error
To concatenate a string and an integer, turn the integer into a string: 'hello' + str(123) = 'hello123'
You'll often see this in a print statement: print('You are ' + str(age) + ' years old.')
+ 7
str(obj) returns type(obj).__str__(obj)
>>> str(12)
'12'
>>> str(1.2)
'1.2'
>>> str(int)
"<class 'int'>"
>>> str(object())
'<object object at 0x7771fd30e0>'
>>> class A:
... def __str__(self):
... return "A"
...
>>> str(A())
'A'
+ 7
Conversation operator.
Convert the value to string
+ 3
str is standing for string means 'a word' or a line in between two quotes that is (').
+ 2
It is a function that converts certain datatypes into strings.
str(12) returns "12"
+ 1
thanks😭
+ 1
can you give me an example?
0
Str is keyword in Python means string.