Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Jeopardy!
- #Goal is to create a list of lists ie.
- #[[Category 1, Question 1, Answer 1], [Category 1, Question 2, Answer 2]]
- #First iteration will just be Q
- import urllib.request, re
- Question = []
- first_game_id = 3458
- last_game_id = 3713
- for gameid in range(first_game_id, last_game_id):
- webpageid = "http://www.j-archive.com/showgame.php?game_id=" + str(gameid)
- temp=urllib.request.urlopen(webpageid)
- webpage=temp.read()
- temp.close()
- for line in webpage:
- if question != None:
- Question.append(question)
- print(Question)
- #wrong. ??? = figure out which re to insert?
- question = re.match('clue_text\"></td>')
- answer= re.match'correct_response">???&'
- #trying to use re match and compile to match the string and output tuple?
- import urllib.request, re
- webpageid = "http://www.j-archive.com/showgame.php?game_id=" + str(3713)
- temp=urllib.request.urlopen(webpageid)
- webpage=temp.read()
- temp.close()
- question=re.compile(r'clue_text">*?</td>')
- Question = []
- ##
- ##for line in webpage:
- ## print(line)
- ##
- ## if question.match(line) != None:
- ## Question.append(question)
- ##
- ##print(Question)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement