a = [1, 2, 3] # 列表
b = (1, 2, 3) # 元组
c = {1, 2, 3} # 集合
d = {"aaa": 10, "bbb": 20, "ccc": 30} # 字典
# 格式化输出
# 字符 %s,整数 %d %06d,浮点数 %f %.2f
# f'{表达式或变量}'
print("hello %d world %s" % (a[0], b[1]))
print(f'a[0] = {a[0]}, b[1] = {b[1]}')
a = [1, 2, 3] # 列表
b = (1, 2, 3) # 元组
c = {1, 2, 3} # 集合
d = {"aaa": 10, "bbb": 20, "ccc": 30} # 字典
# 格式化输出
# 字符 %s,整数 %d %06d,浮点数 %f %.2f
# f'{表达式或变量}'
print("hello %d world %s" % (a[0], b[1]))
print(f'a[0] = {a[0]}, b[1] = {b[1]}')
发表评论