Ich benutze Python-Version 3.5.2 Ich kann urllib oder urllib2 nicht installieren, um urlopen function.Getting die Ausgabe als "Keine geeigneten Versionen gefunden".Wie erhält man den Text auf einer Webseite mit Python?
Die Ausgabe, die ich für obigen Code bekomme, ist der Quellcode, den wir bekommen, wenn wir "Quellcode prüfen" machen. möchte ich die Ausgabe wie:
The last natural blondes will die out within 200 years, scientists believe.
A study by experts in Germany suggests people with blonde hair are an
endangered species and will become extinct by 2202.
Researchers predict the last truly natural blonde will be born in Finland -
the country with the highest proportion of blondes.
The frequency of blondes may drop but they won't disappear
Prof Jonathan Rees, University of Edinburgh
But they say too few people now carry the gene for blondes to last beyond
the next two centuries.
The problem is that blonde hair is caused by a recessive gene.
In order for a child to have blonde hair, it must have the gene on both
sides of the family in the grandparents' generation.
Dyed rivals
The researchers also believe that so-called bottle blondes may be to blame
for the demise of their natural rivals.
They suggest that dyed-blondes are more attractive to men who choose them as
partners over true blondes.
Tory MP Ann Widdecombe
Bottle-blondes like Ann Widdecombe may be to blame
But Jonathan Rees, professor of dermatology at the University of Edinburgh
said it was unlikely blondes would die out completely.
"Genes don't die out unless there is a disadvantage of having that gene or
by chance. They don't disappear," he told BBC News Online.
"The only reason blondes would disappear is if having the gene was a
disadvantage and I do not think that is the case.
"The frequency of blondes may drop but they won't disappear."
See also:
28 Mar 01 | Education
What is it about blondes?
09 Apr 99 | Health
Platinum blondes are labelled as dumb
17 Apr 02 | Health
Hair dye cancer alert
Internet links:
University of Edinburgh
The BBC is not responsible for the content of external internet sites
Top Health stories now:
Heart risk link to big families
Back pain drug 'may aid diabetics'
Congo Ebola outbreak confirmed
Vegetables ward off Alzheimer's
Polio campaign launched in Iraq
Gene defect explains high blood pressure
Botox 'may cause new wrinkles'
Alien 'abductees' show real symptoms
Links to more Health stories are at the foot of the page.
Dies ist der Inhalt in der Website ist http://www.thefamouspeople.com/singers.php Ich brauche Hilfe zu bekommen.
Ich empfehle Ihnen, den scrapy Rahmen zu verwenden. Sehr einfach zu bedienen, flexibel und spart Ihnen viel Zeit. – Praind
[BeautifulSoup] (https://www.crummy.com/software/BeautifulSoup/) könnte das sein, was Sie benötigen, um Text von einer HTML-Seite zu extrahieren. –
Import urllib3 von BS4 Import BeautifulSoup url = 'http://www.thefamouspeople.com/singers.php' http = urllib3.PoolManager() response = http.request ('GET', URL) Suppe = BeautifulSoup (Antwort) print (soup.get_text(). Streifen()) – vinayak