else/Toolbox/unique.py

21 lines
380 B
Python
Raw Normal View History

2016-12-05 01:50:52 +00:00
'''
Keep the unique lines coming from stdin and print them.
'''
from voussoirkit import clipext
import sys
if len(sys.argv) > 1:
2017-11-03 19:50:16 +00:00
source = sys.argv[1]
2016-12-05 01:50:52 +00:00
else:
2017-11-03 19:50:16 +00:00
source = '!input'
lines = clipext.resolve(source, split_lines=True)
2016-12-05 01:50:52 +00:00
new_text = []
seen = set()
2017-11-03 19:50:16 +00:00
for line in lines:
if line not in seen:
#new_text.append(line)
seen.add(line)
print(line)
2016-12-05 01:50:52 +00:00