我有以下代码,它应该询问用户2的文件名。我得到一个错误的输入()在第二个函数,但不是在第一个,我不明白…下面是错误:
output = getOutputFile()文件"splitRAW.py",第22行,in getOutputFile fileName = input("\t=> ") TypeError:'str‘对象不可调用
# Loops until an existing file has been found
def getInputFile():
print("Which file do you want to split ?")
fileName = input("\t=> ")
while 1:
try:
file = open(fileName, "r")
print("Existing file, let's continue !")
return(fileName)
except IOError:
print("No such existing file...")
print("Which file do you want to split ?")
fileName = input("\t=> ")
# Gets an output file from user
def getOutputFile():
print("What name for the output file ?")
fileName = input("\t=> ")
下面是我的main():
if __name__ == "__main__":
input = getInputFile()
output = getOutputFile()
https://stackoverflow.com/questions/56118639
复制相似问题