Python Learning (1), python Learning

Source: Internet
Author: User

Python Learning (1), python Learning

Print (I, end = '')

Print by one space.

Continue: Terminate this cycle and start the next cycle.

Pass: Skip a block and continue with the code break: exit the append of the loop Column

Extend is used to add more than two:

1 >>> member. extend (['zzz', 'aaa']) 2> member3 ['turtle ', 'pudding', 'night', 'lost out', 'yijing ', 'fulu doll ', 'zzz', 'aaa']

Insert:

Delete element (1) remove

1 member. remove ('peony ')

(2) del

(3) pop

Parts

Zip:

>>> a = [1,2,3,4,5,6,7,8]>>> b = [4,5,6,7,8]>>> zip(a,b)>>> list(zip(a,b))[(1, 4), (2, 5), (3, 6), (4, 7), (5, 8)]

 

Copy list

Reverse: Flip list

Sort: sort the list

Tple: comma is the key

>>>temp = (1,)>>>type(temp)<clsss 'tuple'>
>>>temp = 1,

Format

>>>'{0:.1f}{1}'.format(27.658,'GB')'27.7GB'

Sum

>>>tuple1 = (3,2,4)>>>sum(tuple1)9

 

 

 

Related Article

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.