Python error: FileNotFoundError: [Errno 2] No such file or directory
问题 I am trying to open the file from folder and read it but it's not locating it. I am using Python3 Here is my code: import os import glob prefix_path = "C:/Users/mpotd/Documents/GitHub/Python-Sample- codes/Mayur_Python_code/Question/wx_data/" target_path = open('MissingPrcpData.txt', 'w') file_array = [os.path.abspath(f) for f in os.listdir(prefix_path) if f.endswith('.txt')] file_array.sort() # file is sorted list for f_obj in range(len(file_array)): file = os.path.abspath(file_array[f_obj])