Make languages in the listing be links to the actual files

This commit is contained in:
thatHexa
2017-02-19 19:28:06 +02:00
parent 5bffac478e
commit 292823b694
2 changed files with 496 additions and 497 deletions

View File

@@ -16,10 +16,10 @@ readme.write('\n### This repository currently contains "Hello World" programs in
for dir in os.listdir('.'):
if not (dir == '.' or dir == '..' or dir[0] == '.' or os.path.isfile(dir)):
for file in os.listdir(dir):
if os.path.isfile(f"{dir}/{file}"):
if os.path.isfile(f'{dir}/{file}'):
lang = ''
for str in file[0:(len(file) if file.find('.') == -1 else file.find('.'))].replace('-', ' ').replace('_', ' ').split():
lang += str.capitalize() + ' '
readme.write('* ' + lang[:-1] + '\n') # Cut trailing space
readme.write(f'* [{lang[:-1]}]({dir if dir != "#" else "%23"}/{file})\n') # Cut trailing space
readme.close()