📜  在 python 代码示例中创建动态变量

📅  最后修改于: 2022-03-11 14:46:05.797000             🧑  作者: Mango

代码示例1
for i in range(0, 9):
    globals()[f"my_variable{i}"] = f"Hello from variable number {i}!"


print(my_variable3)
# Hello from variable number 3!