我需要'person%s' % x
等于'textvar%s' % x
,但我不想将'person%s' % x
设置为people[int('%s' % x)]
。
global people
people = ['Zach : 10', 'Danielle : 10']
global num
num = len(people)
for x in range(0, numDebt):
globals()['textvar%s' % x] = people[int('%s' % x)]
globals()['person%s' % x] = textvar%i % x