Python-100-Days
Python-100-Days copied to clipboard
练习中 print 的更好写法
可以用一些更简单的的字符串格式化方法
- 如变量插入字符串:
friend1 = "neko" friend2 = "Deta" print(f"My friends are {friend1} and {friend2}")
- 还有另一种简单的方法
friend = "neko" print("My friend is", friend) # 上面两个字符串之间会插入一个空格
friend1 = "neko" friend2 = "Deta" print(f'My friends are {friend1} and {friend2}')