experiments

All kinds of coding experiments
Log | Files | Refs | Submodules

python_challenge4.py (444B)


      1 import urllib.request
      2 import re
      3 
      4 page = urllib.request.urlopen('http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=12345')
      5 text = page.read().decode("utf-8")
      6 discovery = re.search("\d+$", text)
      7 while(discovery):
      8     page = urllib.request.urlopen('http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing={}'.format(discovery.group()))
      9     text = page.read().decode("utf-8")
     10     discovery = re.search("\d+$", text)
     11     print(text)