![](/img/trans.png)
[英]I need to get rid of the print statement while outputting the same thing. How can I change this code so there is zero print statements
[英]How can I change this so the user can type their directory and get rid of the byte error?
import zipfile
try:
with zipfile.ZipFile("daysv2.zip") as file:
file.extractall(pwd='abc123')
except Exception as e:
print(e)
else:
print("Extraction was successful")
如何更改此設置以便用戶可以鍵入他們的目錄和密碼? 另外我將如何解決這個錯誤
pwd: expected bytes, got str
pwd
必須是一個bytes
對象,它被寫入/指示,例如b'abc123'
。 或更籠統地說:
bytes('abc123', 'UTF-8') # For UTF-8 encoded string -> bytes
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.