python string variable names and numbers

3 a and 3 into and becomes a3 df_ df_3

i=3
'a'+str(i)

结果:
'a3'
for i in range(24):
    print('df_'+str(i))

结果:
df_0
df_1
df_2
df_3
df_4
df_5
df_6
df_7
df_8
df_9
df_10
df_11
df_12
df_13
df_14
df_15
df_16
df_17
df_18
df_19
df_20
df_21
df_22
df_23

 

Published 35 original articles · won praise 26 · views 80000 +

Guess you like

Origin blog.csdn.net/weixin_42342968/article/details/85045838