What does string mean in python

藏色散人
Release: 2019-08-01 15:54:15
Original
16238 people have browsed it

What does string mean in python

What does string mean in python?

In python string is a string, and a string is The most commonly used data types in Python. We can use quotes (' or ") to create strings.

Creating a string is as simple as assigning a value to a variable.

For example:

var1 = 'Hello World!'
var2 = "Python"
Copy after login

Python does not support single character types, and single characters are also used as a string in Python.

When Python accesses substrings, you can use square brackets to intercept the string, as shown in the following example:

Example (Python 2.0)

#!/usr/bin/python
 
var1 = 'Hello World!'
var2 = "Python Runoob"
 
print "var1[0]: ", var1[0]
print "var2[1:5]: ", var2[1:5]
Copy after login

Execution results of the above examples:

var1[0]:  H
var2[1:5]:  ytho
Copy after login

Related recommendations: "Python Tutorial"

The above is the detailed content of What does string mean in python. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!