You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

472 B

code_gen.py

#!/usr/bin/python3

from site_gen import get_ext
import os

def mkformat(name, lines):
	result = []
	result.append(f'# {name}\n')
	result.append('```python\n')
	result += lines
	result.append('```')
	return result

if __name__=='__main__':
	files = [(i + '.py', i + '.md') for i in get_ext('.', '.py')]
	
	for py, md in files:
		with open(py) as p:
			with open(md, 'w') as m:
				m.writelines(mkformat(os.path.split(p.name)[1], p.readlines()))