user3093445
user3093445

Reputation: 119

Generating a list of URLs in Python based on a .csv list of queries

I've got a .csv with 10,000+ rows of queries that I'd like to add on to the end of a domain (www.abcdef.com/xxxxxx).

What is the best way to go about building all of these URLs?

I'm a python beginner and I know how to generate a list based off using a manually created dictionary, but how do I read/write from a .csv row by row?

Any input is appreciated.

Upvotes: 1

Views: 79

Answers (2)

m.wasowski
m.wasowski

Reputation: 6387

For reading and writing CSV see csv module. For manipulating URLs, see urlparse.urljoin (in Python3 urlllib.parse module)

I would also recommend to use set() for storing URL for each domain. You avoid duplicates this way.

Upvotes: 1

Karl
Karl

Reputation: 3464

Python has a csv module that can do this work for you.

Upvotes: 0

Related Questions