python3 - 2to3 + miscell obvious tweaks
[sfa.git] / readme.py
1 #!/usr/bin/env python
2
3
4
5 from argparse import ArgumentParser
6
7 # sudo pip install markdown
8 import markdown 
9 import zipfile
10
11 usage="transform README.md into index.html and zip into index.zip"
12 parser = ArgumentParser(usage=usage)
13 args = parser.parse_args()
14
15 input="README.md"
16 output="index.html"
17 zipped="index.zip"
18
19 with open(output,"w") as o:
20     with open(input) as i:
21         html = markdown.markdown (i.read())
22         o.write(html)
23 print ("(Over)written {}".format(output))
24
25 with zipfile.ZipFile(zipped,'w') as z:
26     z.write(output)
27 print ("(Over)written {}".format(zipped))
28