Created
December 13, 2022 17:29
-
-
Save jinnosux/2b99e11f779c17793393d02fbf5734ad to your computer and use it in GitHub Desktop.
ng-awards-2022
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 xlsxwriter | |
workbook = xlsxwriter.Workbook("example.xlsx") | |
worksheet = workbook.add_worksheet() | |
categories = ['Best Cop', 'Best Paramedic', | |
'Best Hitman', 'Best Gunrunner', 'Best Thief', | |
'Best Driver', 'Best Pilot', 'Best Dressed Player', | |
'Best Gold Rush Finder', 'Funniest Player', 'Most Helpful Player', | |
'Best New Player', 'Most Reformed Player', 'NG Couple', 'Server Bitch', | |
'Biggest Asslicker', 'Biggest Simp', 'Biggest Rager', 'Most Friendly Admin', | |
'Most Effective Admin', 'Most Abusive Admin', 'Favorite Vehicle', 'Best NG Video', | |
'Best NG Shorts', 'Best New Feature', 'Best DJ'] | |
def search_str(word): | |
with open("file.txt", 'r', encoding="utf8") as file: | |
award = [] | |
for line in file: | |
if word in line: | |
print(line) | |
try: | |
award.append(line.split(word+": ")[1].rstrip()) | |
except IndexError: | |
pass | |
worksheet.write(0, col, category) | |
worksheet.write_column(3, col, award) | |
print(col) | |
col = 0 | |
for category in categories: | |
print(category) | |
search_str(category) | |
col += 1 | |
workbook.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment