Created
June 2, 2024 05:17
-
-
Save sadkris/251bb18c0eb165c532067c7fe5986428 to your computer and use it in GitHub Desktop.
Every PC Game without any letter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import requests | |
| import string | |
| import warnings | |
| warnings.simplefilter(action='ignore', category=FutureWarning) | |
| alphabet = string.ascii_uppercase | |
| 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 any([i in alphabet for i 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