Eli Leaderboard/leaderboard.py

This is the Python 3.8.6 code to format the Eli leaderboard to wikitext for easy input into the table.
#leaderboard.py
# Author: 20wontons#6777
# Last updated: 6 January 2021
# Python version: 3.8.6
# Known bugs: None
# Change log: None
def format_lead(rank: str) -> str:
 Formats the leaderboard to wikitext.
 if rank == :
 return ''
 rank_list = rank.split('\n')
 formatted = ''
 for line in rank_list:
 dash1 = line.index('-')
 paren = line.index('(')
 dash2 = line.index('-', int(len(line)/2))
 formatted += line[dash1+2 : dash1+8]
 formatted += "" + line[dash1+8 : paren-1] + " "
 formatted += line[dash2:]
 return formatted
if __name__ == '__main__':
 for i in range(20):
 rank = input()
 print(format_lead(rank))
"""
##### Input Format: #####
:first_place: - Level 60 (9,462/21,100xp) (44.84%) - waffle#1744
:second_place: - Level 47 (2,983/13,490xp) (22.11%) - aurora#1126
:third_place: - Level 46 (12,261/12,980xp) (94.46%) - ShadowFacha#3609
#4 - Level 44 (3,744/11,980xp) (31.25%) - Habzee Wabzee#0292
#5 - Level 43 (10,762/11,490xp) (93.66%) - eggy#4422
#6 - Level 43 (3,130/11,490xp) (27.24%) - I. onely#2386
#7 - Level 42 (10,129/11,020xp) (91.91%) - Iphone5se_boi#0742
#8 - Level 42 (7,104/11,020xp) (64.46%) - Sora.#0999
#9 - Level 41 (6,418/10,550xp) (60.83%) - Kurylo#0625
#10 - Level 41 (3,804/10,550xp) (36.06%) - Commie#9593
#11 - Level 41 (1,225/10,550xp) (11.61%) - Ban#7901
#12 - Level 39 (1,996/9,650xp) (20.68%) - Ajay#1584
#13 - Level 38 (8,635/9,220xp) (93.66%) - Torkok#1210
#14 - Level 38 (5,458/9,220xp) (59.20%) - marty#0002
#15 - Level 36 (2,148/8,380xp) (25.63%) - ocat#2411
#16 - Level 36 (1,093/8,380xp) (13.04%) - Hejeiabehsk#7529
#17 - Level 35 (5,165/7,970xp) (64.81%) - mio#0002
#18 - Level 35 (4,375/7,970xp) (54.89%) - situation#7801
#19 - Level 35 (3,590/7,970xp) (45.04%) - Bud#3025
#20 - Level 35 (1,837/7,970xp) (23.05%) - FractalCyclone#0121
##### EOF #####
##### Output Format: #####
Level 54 - waffle#1744
Level 45 - aurora#1126
Level 44 - ShadowFacha#3609
Level 42 - Cnolii#0823
Level 39 - Habzee Wabzee#0292
Level 38 - Commie#9593
Level 37 - Ban#7901
Level 36 - Sora.#0999
Level 36 - Iphone5se_boi#0742
Level 35 - Kurylo#0625
Level 35 - Ajay#0005
Level 35 - marty#0002
Level 34 - geggie93#7628
Level 33 - I. onely#2386
Level 31 - Torkok#1210
Level 31 - Ocatwam#2411
Level 30 - Bud#3025
##### EOF #####
"""
Category:Documentation