创建python列表
方法一:直接创建列表
a = [1, 2, 3, 4, 5]
print(a)
/usr/local/bin/python3.8 /Users/sataniya/PycharmProjects...print(a)
/usr/local/bin/python3.8 /Users/sataniya/PycharmProjects/demo/demo.py
['hello', 'world']
方法四:使用列表推导式...PycharmProjects/demo/demo.py
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/184390.html