0
嘗試將xml文件保存到zip文件中,但是我收到目錄錯誤。我有以下代碼:將urlretrieve保存到zip文件python
if not os.path.exists(log_file_path):
os.makedirs(log_file_path)
for s in xml_list:
parent_file = zipfile.ZipFile(zip_file_name, "w")
urllib.urlretrieve(log_repository_url + "/r.xml", zip_file_name + "\\r.xml")
parent_file.close()
錯誤是說我在zip文件中沒有r.xml。此代碼不應該創建.xml文件並寫入它?如果不是,我該如何繼續?
謝謝!
這不是檔案文件的實際工作方式,只是Explorer如何僞造它們。 –