1
flyingghost 2018-02-06 20:33:20 +08:00
#!/usr/bin/python
# * coding: UTF 8 * import sys if sys.argv[1]: path = sys.argv[1] myfile = open(path) try: for line in myfile: newline = '' for c in line: if c == ' ': newline += '-' else: break newline += line.strip() print(newline) finally: myfile.close() |
2
flyingghost 2018-02-06 20:34:17 +08:00
@flyingghost V2 不给编辑 /删除真是让人羞愤。。。
|
3
flyingghost 2018-02-06 20:36:51 +08:00
#!/usr/bin/python
# -*- coding: UTF-8 -*- import sys if sys.argv[1]: path = sys.argv[1] myfile = open(path) try: for line in myfile: newline = '' for c in line: if c == ' ': newline += '-' else: break newline += line.strip() print(newline) finally: myfile.close() |
4
flyingghost 2018-02-06 20:38:45 +08:00
嗯。。。换成全角空格稍微好看一点。
虽然和-号一样不能复制。 |
5
twor OP @flyingghost 具体怎么把半角空格怎么替换成全角空格呢?
我搜了一下 newline += u'\u3000' 好像替换后,贴到这里,是乱的 |
6
8023 2018-02-06 21:05:33 +08:00 via Android
emmm 为啥不用 gist 呢?
|
9
congeec 2018-02-07 15:45:58 +08:00 1
用 vim 插件 identLine 可破
|