python中这样的写法怎么理解
PHP中文网
PHP中文网 2017-04-18 10:14:49
0
2
306
PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
大家讲道理

PEP0202 List Recursion: https://www.python.org/dev/pe...

Explain a little bit:

  • result is a container containing tuples

  • Each element in the container contains two values, the first represents the status True/False, and the second value is a dict

  • If the status in the element is True, take the path value in the dict

伊谢尔伦

Broken it apart to write:

for ok, x in results:
    if ok:
        print(x['path'])

In fact, it’s just an abbreviation. Its main function is to make the code simple and beautiful, so don’t worry too much.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template