19 lines
359 B
Python
19 lines
359 B
Python
#!/usr/bin/env python
|
|
|
|
|
|
import re
|
|
import sys
|
|
|
|
|
|
# %%
|
|
def replace_title_with_list(text):
|
|
text = re.sub(r'#(#+)\s*(.*)', r'\1- \2', text)
|
|
text = re.sub(r'#', ' ', text)
|
|
return text
|
|
|
|
|
|
def __main__():
|
|
# read file passed as argument
|
|
with open(sys.argv[1], 'r') as my_file:
|
|
text = my_file.read()
|
|
print(replace_title_with_list(text))
|