Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Created May 27, 2021 09:11
Show Gist options
  • Save nikomatsakis/aa87dd60b673e49e39ffcdb0737b36fd to your computer and use it in GitHub Desktop.
Save nikomatsakis/aa87dd60b673e49e39ffcdb0737b36fd to your computer and use it in GitHub Desktop.
#!/bin/python
# coding=utf8
import sys
file_objs = [sys.stdin]
prefix = "│ ├─┐─┘"
for file_obj in file_objs:
while True:
line = file_obj.readline()
output_list = []
for c in line:
if c in prefix:
output_list.append(' ')
else:
output_list.append(c)
output_line = "".join(output_list)
if not output_line.isspace():
sys.stdout.write(output_line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment