mconfigQuantity = int(raw_input('Enter the number of (m)achine-configurations that you will need: '))
numberOfmconfig = 1
for mconfigs in range(1,mconfigQuantity+1):
# %s conditional for mcidentifier
STRINGnumberOfmconfig = str(numberOfmconfig)
if STRINGnumberOfmconfig[-1] == '1':
suffix = 'st'
elif STRINGnumberOfmconfig[-1] == '2':
suffix = 'nd'
elif STRINGnumberOfmconfig[-1] == '3':
suffix = 'rd'
else: suffix = 'th'
finalConfigName = STRINGnumberOfmconfig + suffix
mcidentifier = raw_input('Enter the letter of your %s (m)achine-configuration: ') % (finalConfigName)
numberOfmconfig = numberOfmconfig + 1
print mconfig()
我已经多次编写并重写了此代码段,但对于我为什么要打印“%s”而不是用我为它指定的数据替换它是没有意义的。我找不到任何表明它为什么不起作用的东西。