S
S
smoboom2020-05-17 14:45:30
Python
smoboom, 2020-05-17 14:45:30

How to parse title from websites using python?

I'm new to python and can't seem to figure out how to implement the following task.
There is a txt file with domains (about 10,000 domains), saved in upper case. You need to:
- transfer domain addresses to lowercase
- add the string 'http://' at the beginning of the domain, so that the domain can then be inserted into requests
- make a loop so that the parser collects a title from each domain (site)
- write everything to a file a table with two fields | site url | website title |

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Korol, 2020-05-17
@welcome32

1) You can convert a string to lowercase using the str.lower() string method
2) You can add it at the beginning of a string like this: link = r"https://" + link
3)

for link in links:
      [some parsing link site]

4) Well, this is working with files in Python

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question