Compatibility with older versions of Python (Closes #395)

This commit is contained in:
Luke Deen Taylor
2017-03-28 14:12:22 +00:00
parent 3fd7b29a8d
commit 5a7563017b

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(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()