Updated list_langs (now in python) and executed it

This commit is contained in:
thatHexa
2017-02-16 21:32:08 +02:00
parent b4fceac8cf
commit 141cab89de
3 changed files with 522 additions and 526 deletions

25
list_langs.py Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env python
import os
readme = open('README.md', 'w')
# Copy template to README
with open('README_nolist.md', 'r') as temp:
for line in temp:
readme.write(line)
# Write title
readme.write('\n### This repository currently contains "Hello World" programs in the following languages:\n')
# List the available languages
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}"):
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.close()