str in Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

str in Python?

Who can clear me what is str in python and what is its role?

21st Apr 2020, 6:07 PM
Muhammad Rakhimov
Muhammad Rakhimov - avatar
2 Answers
+ 2
Strings are most popular types in python. We can create them by enclosing the content within single or double quotation marks. Example: "Hello" 'World' Docstrings are enclosed within triple quotation marks Example: ''' This is an answer ''' str is used to convert to string datatype. Example: a=7 b=str(a) print(b) output >>> '7'
21st Apr 2020, 6:13 PM
ashish tripathi
ashish tripathi - avatar
+ 1
str denotes string class in python and it is used to perform all the operations related to the strings like concatenation, length of string, etc.
21st Apr 2020, 6:09 PM
Akshay Jain
Akshay Jain - avatar