Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in Data Science by (18.4k points)
edited by

This is my code:

import zipfile


    with zipfile.ZipFile("") as file:


except Exception as e:



    print("Extraction was successful")

I want to change such that the user can type the directory and his/her password? I also want to fix this error of

PWD: expected bytes, got st

1 Answer

0 votes
by (36.8k points)
edited by

The pwd must be a bytes object, which is written/indicated such as b'abc123'. Or more generically:

bytes('abc123', 'UTF-8') # For UTF-8 encoded string -> bytes

If you want to know more about the Data Science then do check out the following Data Science which will help you in understanding Data Science from scratch 

Browse Categories