Day1-Python basics, day1-python Basics
Python is the product of Daniel's "boring" Christmas holiday. -- For details, refer to Baidu encyclopedia.
- Python official introduction:
Python is a simple, easy-to-learn and powerful programming language. It has an efficient High-Level Data Structure and implements Object-Oriented Programming simply and effectively. Python's concise syntax and support for Dynamic Input, coupled with the essence of explanatory language, make it an ideal scripting language in many fields on most platforms, it is especially suitable for fast application development.
- Basic concepts of Python
Integer
Long Integer 000000000,900000000000000
Floating Point Number 3.1415926
Plural 2 ** 10
You can use single quotation marks (''), double quotation marks (" "), and three quotation marks (''' or") to indicate a string.
Use range '<"""(''')
"", Can also be used as comments for multiple rows
"Dogs"
["Apple", "pear", "orange"]
("Apple", "pear", "orange ")
{"A1": "Apple", "A2": "Pear", "A3": "Orange "}
>>> List_F = ["Apple", "Pear", "Orange"]
>>> List_F
['Apple', 'pear ', 'Orange']
>>> List_F [0]
'Apple'
>>> List_F [1]
'Pear'
>>> List_F [-1]
'Orange'
>>> List_F [:-1]
['Apple', 'pear ']
>>> List_F [0:-1]
['Apple', 'pear ']
>>> List_F [0:]
['Apple', 'pear ', 'Orange']
- Tuples:
> Tuple_F = ("Apple", "Pear", "Orange ")
>>> Tuple_F [0]
'Apple'
>>> Tuple_F [1]
'Pear'
>>> Tuple_F [-1]
'Orange'
>>> Tuple_F [:-1]
('Apple', 'pear ')
>>> Tuple_F [0:-1]
('Apple', 'pear ')
>>> Tuple_F [0:]
('Apple', 'pear ', 'Orange ')
- String slicing:
>>> Str_1 = "apple"
>>> Str_1 [0]
'A'
>>> Str_1 [1]
'P'
>>> Str_1 [2]
'P'
>>> Str_1 [-1]
'E'
>>> Str_1 [0:-1]
'Appl'
>>> Str_1 [0:]
'Apple'
>>> Str_1 [1:-1]
'Ppl'