Good day! There is a function
def conv(self): self.iniString = [] for self.files in os.listdir(self.dir): # Фильтр на .ini файлы. if fnmatch.fnmatch(self.files, '*.ini'): with open(self.dir + '/' + self.files) as file: # Считываем .ini файл в список self.iniString = file.read().splitlines() # Забираем имя файла self.fileName = os.path.splitext(self.files)[0] # Создаем в заданной директории файл с именем self.fileName.json self.jsonFiles = open(self.dir + '/' + self.fileName + '.json', 'w') self.jsonFile = ' \n'.join(self.iniString) self.jsonFiles.write(self.jsonFile) This self.iniString problem self.iniString assigned 2 lists, self.iniString selected directory stores 2 - .ini files, then 2 - .json files are created in the specified directory, as it should be, but the contents of the 2 lists from self.iniString written in the first .json. How to fix in such a way that the 1st list in 1.json, and the 2nd in the second?