f字符串同樣支持使用字典和列表來(lái)嵌入變量,例如: 1 2 3 4 person={"name":"Tom","age":20} print(f"My name is {person['name']}, and I am {person['age']} years old.") numbers=[1,2,3,4,5] print(f"The first number is {numbers[0]}, and
www.dbjr.com.cn/python/286083f...htm 2025-6-5