我有一個任務,涉及從文件中提取一些信息。但是,我不確定它爲什麼不起作用。打開文本文件
def main():
print("Hello, this program will create a")
print("bar graph showing the sales")
print("\n\nSales Bar Graph")
INFILE = open("sales.txt", "r")
store1, store2, store3, store4, store5 = (INFILE.read()).split(", ")
print(store1)
當我嘗試運行此程序時,沒有任何反應。
確定該文件的路徑正確嗎? 嘗試使用文件的完整路徑。 – amahfouz