Skip to content

Instantly share code, notes, and snippets.

@fourohfour
Created November 14, 2014 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fourohfour/6938e4ad3f59c18dda26 to your computer and use it in GitHub Desktop.
Save fourohfour/6938e4ad3f59c18dda26 to your computer and use it in GitHub Desktop.
French Words
import urllib.request
for i in range(10):
while True:
req = urllib.request.Request("http://fr.wiktionary.org/wiki/Sp%C3%A9cial:Page_au_hasard")
page = urllib.request.urlopen(req)
page = str(page.read())
psplit = page.split('<h1 id="firstHeading" class="firstHeading" lang="fr">', 1)
title = psplit[1].split("</h1>", 1)[0]
newtitle = ""
add = True
for char in title:
if char == "<":
add = False
if add:
newtitle = newtitle + char
if char == ">":
add = True
if "\\" in newtitle:
continue
else:
break
print(newtitle)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment