Skip to content

py的"列表生成式"语法 #96

Description

@any86
c= [i*2foriin [3,21,67]]
print(c)
# [6, 42, 134]

"[]"里分2部分,后面的循环决定数组内容的长度, 前面是数组每一位的内容.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions