Conditions | 2 |
Total Lines | 14 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import sys |
||
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 | |||
21 |