What would be the simplest way to get the title of a page in Requests?
r = requests.get(\'http://www.imdb.com/title/tt0108778/\')
# ? r.title
Friends (TV Ser
No need to import other libraries. Request has this functionality in-built.
>>> hearders = {'headers':'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0'}
>>> n = requests.get('http://www.imdb.com/title/tt0108778/', headers=hearders)
>>> al = n.text
>>> al[al.find('') + 7 : al.find(' ')]
u'Friends (TV Series 1994\u20132004) - IMDb'
Update after ZN13's comment
>>> import re
>>> import requests
>>> n = requests.get('https://www.libsdl.org/release/SDL-1.2.15/docs/html/guideinputkeyboard.html')
>>> al = n.text
>>> d = re.search('<\W*title\W*(*)>> d.group(1)
u'Handling the Keyboard'
This will work for all cases whether extra non alphabetical characters are present with title tag or not.