• 周日. 5月 26th, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

列表推导

admin

11月 28, 2021

列表推导:

#列表推导
li = [1, 2, 3, 4, 5, 6, 7, 8, 9]
li_l = [i for i in li if i % 2 == 0]   #在新列表内加入表达式
print(li_l)

li = [1, 2, 3, 4, 5, 6, 7, 8, 9]
li_l = [i*2 for i in li]             #在新列表内加入表达式
print(li_l)

《列表推导》有一个想法
  1. Wow, amazing weblog layout! How lengthy have you ever been blogging for?

    you make running a blog look easy. The full
    look of your site is magnificent, as neatly as the content material!
    You can see similar here sklep online

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注