Skip to content

Instantly share code, notes, and snippets.

@jleedev
Created October 24, 2019 15:54
Show Gist options
  • Save jleedev/6f71e57be6dff02a40298b6dff9d6769 to your computer and use it in GitHub Desktop.
Save jleedev/6f71e57be6dff02a40298b6dff9d6769 to your computer and use it in GitHub Desktop.
import os
import sys
arg = sys.argv[1]
start = os.getcwd()
os.mkdir('tmp')
os.chdir('tmp')
for c in arg:
os.mkdir(c)
os.chdir(c)
output = ''
while os.getcwd() != start:
os.chdir('..')
d = os.listdir()
if len(d) > 1:
os.rmdir('tmp')
break
[d] = d
os.rmdir(d)
output += d
print(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment