当前位置:主页 > 软件编程 > Python代码 >
时间:2021-04-08 10:37:24 | 栏目:Python代码 | 点击:次
Python版本 3.0以上
分别打印列表中的元素有两种:
方法一
a = [1,2,3,4] print(*a,sep = '\n') #结果 1 2 3 4
方法二
a = [1,2,3,4] [print(i) for i in a] #结果 1 2 3 4 [None, None, None, None]