Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Python Notes-data types

Shulou Source: shulou.com Published: 2022-06-03 03:09:24 10月02日 Update

Http://www.runoob.com/python/python-tutorial.html rookie tutorial

1. Number, which can be defined directly, a = 18

two。 String, a = 'helloworld'

Operations that can be performed in a sequence include indexing, slicing, adding, multiplying, and checking members.

3. List, list = [1, 2, 2, 3, 4, 4, parentheses

4. Tuple, the element of tuple cannot be modified, tup = ('aaa',1,2,3,'ddd'), parentheses indicate

5. Dictionary, key-value pair, d = {key1: value1, key2: value2}, the key is unique

Curly braces

String manipulation:

Var1 = 'Hello Worldwide'

Var2 = "Python Runoob"

Print "var1 [0]:", var1 [0] # take values according to subscript

Print "var2 [1:5]:", var2 [1:5] # intercepts several values

Output result:

Var1 [0]: H

Var2 [1:5]: ytho

Tags: Characters strings parentheses subscripts elements dictionaries sequences members tutorials numbers indexes results rookie tutorials brackets rookies checks output data notes types Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Apple MySQL Redmi macOS