I would like to use urlparse
, but Python 3 is not finding the module.
I do import urlparse
, but it gives me this error
ImportError: no 'module' named urlparse
I would like to use urlparse
, but Python 3 is not finding the module.
I do import urlparse
, but it gives me this error
ImportError: no 'module' named urlparse
The urlparse in Python 2.7.11 was renamed to urllib.parse in Python 3.
So, if you have a code such from urlparse import urljoin
, I suggest you change it to from urllib.parse import urljoin
As noted in urlparse
's documentation:
Note The
urlparse
module is renamed tourllib.parse
in Python 3. The 2to3 tool will automatically adapt imports when converting your sources to Python 3.
I.e., just use urllib.parse
instead:
import urllib.parse
python3-tools
rpm. Once installed, just run 2to3 myscript.py
. –
Wigley © 2022 - 2024 — McMap. All rights reserved.