Skip to content

Instantly share code, notes, and snippets.

@richardkiss richardkiss/sl
Created Mar 30, 2018

What would you like to do?
A "mirror-image" ls in python, as discussed at
#!/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)))
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.