Skip to content Skip to sidebar Skip to footer

Convert List Of String Into List Of Url Using Python

I Have a list of string(which are actually URL) ['https://part.of.url/P2000-01.xls', 'https://part.of.url/P2001-02.xls', 'https://part.of.url/P2002-03.xls', 'https://part.of.

Solution 1:

"quote" is the wrong method for this. It is used specifically to remove special characters from a string, which is what you are seeing.

If you are trying to build url objects, urllib.parse.urlparse(urlValue) would be the method you want.

As someone new to python- the urllib libraries are pretty low API. Assuming you're trying to make network connections, I would strongly recommend looking at the "requests" library from pypi, which is a much simpler user interface.

Solution 2:

I think you don't need to quote. It should work with the following code. If not then please clarify and share your full source.

for urlValue in url:
        print(urlValue)

Post a Comment for "Convert List Of String Into List Of Url Using Python"