we always have to travel, and eventually we have to say goodbye to the young, farewell is the road to growth of austerity. Hello python-day2!
- Five types of built-in data structures in Python:
- Variable name = "Guanqing"
- List name = [' User1 ', ' user2 ', ' User3 ']
- Dictionary name = {' name ': ' guanqing ', ' Age ': 28}
- File file.txt
- MySQL Database
- list.append (' AA ') #增加. Add an item at the end of the list
1>>> list = ['guanqing','Wukun','Lizhe','hongbing']2>>> List.append ('Qihui')3>>>List4['guanqing','Wukun','Lizhe','hongbing','Qihui']
List.insert (2, ' AA ') #增加. Inserts an element at a position in the list, counting the position starting at 0
1>>>List2['guanqing','Wukun','Lizhe','hongbing','Qihui']3>>> List.insert (2,'Eric')4>>>List5['guanqing','Wukun','Eric','Lizhe','hongbing','Qihui']
- The Max/min/len function in Python, as the name implies
1 >>> list2 = [5,3,5,1] 2 >>> max (list2)34 >>> min (list2) 5 1 6 >>> len (list2)76
- the For loop in the list
1>>> list = ['3','6','7','9','1',' A']2>>> forLineinchlist:3.. print'Hello%s'% Line4 ... 5Hello36Hello67Hello78Hello99Hello1TenHello A
Python's Way of combat-day2