Skip to content

Instantly share code, notes, and snippets.

@richardkiss richardkiss/sl
Created Mar 30, 2018

Embed
What would you like to do?
A "mirror-image" ls in python, as discussed at https://news.ycombinator.com/item?id=16716150
#!/usr/bin/env python
import subprocess
import sys
output = subprocess.check_output(["ls"] + sys.argv[1:])
lines = output.split("\n")
size = max(len(_) for _ in lines)
spaces = " " * size
for l in lines:
line = (l + spaces)[:size]
line = ''.join(list(reversed(line)))
print(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.