Why is the next code not working? I cant find why.
import mimetypes
import glob, urllib
for file in glob.glob("C:\\Users\\joey\\Desktop\\school\\ICOMMH"):
url = urllib.pathname2url(file)
print(file, mimetypes.guess_type(url))
The error message I get is:
AttributeError: 'module' object has no attribute 'pathname2url'
I am trying display all file typs of a directory. Is this a good way? Or is there a better way. I dont want to use the module magic.
This function's location has changed in Python 3. It is now urllib.request.pathname2url.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With