Parsing of Python lists

Source: Internet
Author: User

Original: http://blog.csdn.net/xiaobuding007/article/details/78726833

Https://www.cnblogs.com/liu-shuai/p/6098227.html

In the test work, the use of randomly generated the correct phone number, at first I used the first is 1, the last 10 bits 0 to 9 random numbers, but such a string of numbers, not the correct phone number, so on the site see the following code.

Because your previous code is cumbersome, not yet correct, learn this code: Python list parsing:

List parsing

The way you create new lists efficiently, based on an existing list.

List parsing is an application of the Python iteration mechanism, which is commonly used to create new lists and is therefore used in [].

Grammar:

[Expression for iter_val in iterable]

[Expression for Iter_val in iterable if COND_EXPR]


 

Parsing of Python lists (go)

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.