git @ Cat's Eye Technologies The-Dipple / d351980
Add a silly Python script to substitute certain characters in a file. catseye 13 years ago
1 changed file(s) with 18 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 #!/usr/bin/env python
1 # encoding: UTF-8
2
3 import sys
4 import fileinput
5
6 MAP = {
7 '>': '→',
8 '<': '←',
9 '^': '↑',
10 'v': '↓',
11 }
12
13 for line in fileinput.input():
14 if line.startswith("| ") or line.startswith(" "):
15 for char in MAP:
16 line = line.replace(char, MAP[char])
17 sys.stdout.write(line)