Total Complexity | 2 |
Total Lines | 21 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import sys |
||
2 | |||
3 | def py2md(py_file_name): |
||
4 | with open(py_file_name, "r") as py_file: |
||
5 | py_file_content = py_file.read() |
||
6 | |||
7 | temp_name, _ = py_file_name.split(".", 2) |
||
8 | md_file_name = temp_name + ".md" |
||
9 | |||
10 | front_str = "```python\n" |
||
11 | back_str = "```" |
||
12 | md_file_content = front_str + py_file_content + back_str |
||
13 | |||
14 | md_file = open(md_file_name, "w") |
||
15 | md_file.write(md_file_content) |
||
16 | md_file.close() |
||
17 | |||
18 | for i_arg in range(1, len(sys.argv)): |
||
19 | py_file_name = sys.argv[i_arg] |
||
20 | py2md(py_file_name) |
||
21 |