2

How could i improve the following code in order to achieve a decent formatting on the output?

import os
print("file\tsomething")
for root, dirs, files in os.walk(".", topdown=False):
    for name in files:
        print('{}\t{}'.format(name, 'a'))

Current output

file    something
logging_test.py a
sample.log  a
test.py a
__init__.py a

Desired output

file            something
logging_test.py a
sample.log      a
test.py         a
__init__.py     a
thclpr
  • 5,778
  • 10
  • 54
  • 87

0 Answers0