Skip to content

Instantly share code, notes, and snippets.

@sadkris
Created May 31, 2024 14:52
Show Gist options
  • Select an option

  • Save sadkris/acca91b7692f4e6d168c5edde719811a to your computer and use it in GitHub Desktop.

Select an option

Save sadkris/acca91b7692f4e6d168c5edde719811a to your computer and use it in GitHub Desktop.
Every PC Game without "A" in its title
import pandas as pd
import requests
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
pageRoot = "https://en.wikipedia.org/wiki/"
gameLists = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "Numerical"]
validGames = []
def getGameList(letter):
html = requests.get(pageRoot+f"List_of_PC_games_({letter})").text
df = pd.read_html(html)[0]
try:
gameList = df["Name"].tolist()
except:
gameList = df["Title"].tolist()
return gameList
def filterGames():
for letter in gameLists:
letterGames = getGameList(letter)
for game in letterGames:
if not "A" in game.upper():
validGames.append(game)
return validGames
if __name__ == "__main__":
print(filterGames())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment