发布网友 发布时间:2022-04-26 20:37
共1个回答
热心网友 时间:2022-04-06 15:25
希望能提供给你一个思路,另外使用exec也可以
>>> import string
>>> string.ascii_uppercase
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
>>> num = raw_input("Enter a number:")
Enter a number:5
>>> for i in range(int(num)):
... locals()[string.ascii_uppercase[i]] = []
...
>>> A
[]
>>> B
[]
>>> C
[]
>>> D
[]
>>> E
[]
>>> F
Traceback (most recent call last):
File "<stdin>", line 1, in <mole>
NameError: name 'F' is not defined