pcarg 0.0.1
Simple HTML template tool
“两个将文字变成网页以及将网页p标签内容转换为文字的工具”
Python file opened for write or appendPython input prompt with literal text
SHA-2563a0b947d9a1cf137ca7024b321bf0637d4f6be283b2aaa4163e04193a6a96e93
MaleculeH₂(FU)
Evidence
1import sys
2
3def passage_copy():
4 print('使用之前记得测试一下还能不能顺利使用。标题格式:标题名——别名')
5 title = input('请输入标题:')
6 title, title_another = title.split('——')
7 print('请粘贴文本:')
8 lines = sys.stdin.readlines()
9 lines = [f'<p>{line}</p>' for line in lines if line != '\n']
10 content = '\n'.join(lines).replace('\n</p>', '</p>')
11
12 with open('template.html', 'r') as f:
13 template = f.read()
14
15 final = template.replace('{{ title }}', title).replace('{{ content }}', content).replace('{{ title_another }}', title_another)
16
17 with open(f'{title}.html', 'w', encoding='utf-8') as f:
18 f.write(final)
1import sys
2
3def readable_get():
4 t = input('请输入题目:')
5 sys.stdout.write('请放入p标签:\n')
6 s = sys.stdin.read()
7
8 with open(f'{t}.txt', 'w', encoding='utf-8') as f:
9 f.write(s.replace('</p>\n<p>', '\n\n').replace('<p>', '').replace('</p>', ''))
No evidence locations were recorded for this file. Raw result