我正在与局部和全局变量作斗争。
我正在这样做:
def SomeFunc(Input):
if Input == 1:
Input = "True"
elif Input == 0:
Input = "False"
RawInput=int(raw_input("Input 1 or 0: "))
SomeFunc(RawInput)
print str(RawInput)
它表明了这一点:
>>> def SomeFunc(Input):
if Input ==1:
Input = "True"
elif Input ==0:
Input = "False"
>>> RawInput = int(raw_input("Input 1 or 0: "))
Input 1 or 0: 1
>>> SomeFunc(RawInput)
>>> print str(RawInput)
1
我应该怎么做才能将输入转换为函数中的 str ?