How to extract "partly cloudy" from the paragraph tag <p ngcontent-c4="" >Partly Cloudy </p> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to extract "partly cloudy" from the paragraph tag <p ngcontent-c4="" >Partly Cloudy </p>

Web scraping through python

16th Jun 2018, 12:14 PM
Sagar Singh
Sagar Singh - avatar
1 Answer
+ 1
List Slices also work on Strings: line = '<p ngcontent-c4="" >Partly Cloudy </p>' print (line[line.index('>')+1:line.index('</')]) # Prints the Part between '>' and Endtag '</' https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2453/?ref=app
28th Jun 2018, 6:47 PM
Sebastian Keßler
Sebastian Keßler - avatar