1. 列表的基本语法
- 使用中括号
[]
表示列表 - 列表内元素用逗号
,
隔开(注意:逗号为英文输入法下的逗号,
)
student1 = ['Ran', 'class1', 18, 20250417]
student2 = ['Peppa', 'class2', 8, 20250418]
原创2025年4月17日...大约 9 分钟
[]
表示列表,
隔开(注意:逗号为英文输入法下的逗号 ,
)student1 = ['Ran', 'class1', 18, 20250417]
student2 = ['Peppa', 'class2', 8, 20250418]
三种方法:
string = 'I am born for this.' #英文表达
#string = 'I'm born for this.' # I am 缩写成 I‘m,与表示字符串的引号冲突,错误。
string = "I'm born for this." # 正确表达
print(string)
#-------output-------
I'm born for this.