search

Home  >  Q&A  >  body text

python中这样的写法怎么理解

PHP中文网PHP中文网2812 days ago309

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 10:16:49

    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

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:16:49

    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.

    reply
    0
  • Cancelreply