Python built-in functions (38) -- list, python built-in 38 list

Source: Internet
Author: User

Python built-in functions (38) -- list, python built-in 38 list

English document:

ClassList([Iterable])

Rather than being a function,ListIs actually a mutable sequence type, as incluented in Lists and Sequence Types-list, tuple, range

 

Note:

1. list function, which is actually a list-Type constructor.

2. If no parameter is input, an empty list is returned.

>>> A = list () >>> a []

3. You can input an iteratable object, such as a string, byte array, tuples, list, and range object. The result returns a list of elements in the iteratable object.

>>> List ('abcd') # string ['A', 'B', 'C', 'D'] >>> list (bytes ('abcd ', 'utf-8') # byte array [97, 98, 99,100]> list ('A', 'B', 'C', 'D ')) # tuples ['A', 'B', 'C', 'D']> list (['A', 'B', 'C', 'C ', 'D']) # list ['A', 'B', 'C', 'D'] >>> list (range () # range object [1, 2, 3, 4]

 

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.