The meaning of str in python: 1. Represents the string class, you can use quotation marks (' or ") to create a string, for example "str='Hello World!'"; 2. Represents str() Function, convert the object into a form suitable for human reading. The syntax is "str(object='')" and returns the string format of an object.

1. Indicates the string class
You can use quotation marks (' or ") to create a string
The method of creating a str string is as follows:

The commonly used methods of str are as follows:

Indexing and slicing of str:

When encoded with utf-8, one Chinese character is equal to three characters. When using gbk encoding, one Chinese character is equal to two characters.
2. Express the str() function
The str() function is used to convert objects into a form suitable for human reading.
Syntax:
class str(object='')
Parameters
object -- Object.
Return value: Returns the string format of an object.
The following shows an example of using the str() method:
>>>s = 'RUNOOB' >>> str(s) 'RUNOOB' >>> dict = {'runoob': 'runoob.com', 'google': 'google.com'}; >>> str(dict) "{'google': 'google.com', 'runoob': 'runoob.com'}" >>>
The above is the detailed content of What does str mean in python. For more information, please follow other related articles on the PHP Chinese website!
What are environment variables
How to use rank function
wps replacement shortcut keys
msdn official website entrance
Registration-free CDN acceleration service
Usage of setInterval in JS
What is the customer service phone number of Meituan Food Delivery?
How to find the greatest common divisor in C language