1.python不支持i++,但有i+=1和i-=1

2.可以通过help()查询帮助信息,比如help(range)就可以查看range的帮助信息

3.python的list的下标是从0开始的

4.int()函数字符串转int型,float()函数字符串转float型,str()函数字符串转int型

5.len函数既可以计算list的长度,也可以计算字符串的长度

6.注意这段代码生成的list的形状:

>>> a = [range(3) for i in range(5)]
>>> a
[[0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2]]

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2021-11-03
  • 2019-08-28
  • 2021-07-09
  • 2021-12-31
猜你喜欢
  • 2022-12-23
  • 2021-12-01
  • 2021-09-23
  • 2021-06-24
  • 2021-12-15
  • 2022-12-23
相关资源
相似解决方案