Merge pull request #398 from controversial/master
Compatibility with older versions of Python for list_langs.py
This commit is contained in:
@@ -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(os.path.join(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(f'* [{lang[:-1]}]({dir if dir != "#" else "%23"}/{file})\n') # Cut trailing space
|
||||
readme.write('* [{}]({})\n'.format(lang[:-1], os.path.join(dir if dir != "#" else "%23", file))) # Cut trailing space
|
||||
|
||||
readme.close()
|
||||
|
||||
Reference in New Issue
Block a user