Python's Way of combat-day2

Source: Internet
Author: User

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:
    1. Variable name = "Guanqing"
    2. List name = [' User1 ', ' user2 ', ' User3 ']
    3. Dictionary name = {' name ': ' guanqing ', ' Age ': 28}
    4. File file.txt
    5. MySQL Database

    • List:
  1. 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']
  2. 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']
  3. 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
  4. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.