Skip to content

Instantly share code, notes, and snippets.

@jinnosux
Created December 13, 2022 17:29
Show Gist options
  • Save jinnosux/2b99e11f779c17793393d02fbf5734ad to your computer and use it in GitHub Desktop.
Save jinnosux/2b99e11f779c17793393d02fbf5734ad to your computer and use it in GitHub Desktop.
ng-awards-2022
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