【发布时间】:2018-02-25 01:18:17
【问题描述】:
每当我尝试输入“C.elegans_small.gff”时,程序都会给出“无法打开”的打印语句。但是,我希望它打开。为什么会这样?
print("Gene length computation for C. elegans.")
print()
file1 = "C.elegans_small.gff"
file2 = "C.elegans.gff"
user_input = input("Input a file name: ")
while user_input != file1 or user_input != file2:
print("Unable to open file.")
user_input = input("Input a file name: ")
if user_input == file1 or user_input == file2:
break
【问题讨论】:
-
它总是不是一个或另一个。将测试反转为
and -
not file1 or not file 2 <=> not (file1 and file2)这总是正确的......你的意思是not file1 and not file2 <=> not(file1 or file2)
标签: python openfiledialog