a=[i for i in range(10) if i%2==0]
print(a)
a=[i if i%2==0 else 'qi' for i in range(10)]
print(a)
结果:
[0, 2, 4, 6, 8]
[0, 'qi', 2, 'qi', 4, 'qi', 6, 'qi', 8, 'qi']

最新文章

  1. Squirrel: 通用SQL、NoSQL客户端
  2. EasyUi – 2.布局Layout + 3.登录界面
  3. [转]Oracle 树操作(select…start with…connect by…prior)
  4. chubu
  5. 虚幻4以及DX12将允许开发者利用Xbox One的更多性能(转)
  6. C#UDP(接收和发送源码)源码完整
  7. I2C驱动程序
  8. JavaScript Invalid Date Verify
  9. 数据结构——UVA 1600 机器人巡逻
  10. Python基础(六)-内置函数
  11. 【转】TCP/IP协议中TCP和UDP的区别
  12. 【linux】mysql安装问题 g++: not found
  13. casio计算器计算统计数据
  14. Codeforces Round #514 (Div. 2) C. Sequence Transformation 思维构造
  15. 利用StateListDrawable给button动态设置背景
  16. texlive测试是否安装成功
  17. react native获取屏幕的宽度和高度
  18. 《Spring实战》-- 'cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element' 错误的解决办法
  19. here i am(歌手BryanAdams的歌曲)
  20. 【webpack】理解配置文件

热门文章

  1. UNP学习笔记(第十一章 名字与地址转换)
  2. Activity 事件以及如何得到新打开Activity关闭后返回的数据
  3. setTimeout()基础/setInterval()基础
  4. Cocostudio学习笔记(5) Text + TextAtlas + TextBMFont
  5. 封装CLLocationManager定位获取经纬度
  6. 跟我一起写 Makefile(一)[转]
  7. leetCode 84.Largest Rectangle in Histogram (最大矩形直方图) 解题思路和方法
  8. SkipList跳表(一)基本原理
  9. linux支持的machine-types
  10. linux下开启ftp的21号port