I'm doing a homework assignment and have to create a program that creates a file directory that also uses a catch-exception block. I wanted it to look nice by having the fields all justified so it look like a proper output table, but all of my strings (file names and dates created) have these random apostrophes around them. However, my unjustified string and the justified integer values do not.
My Code:
import os, sys, time
try:
path="."
dirs=os.listdir(path)
except IOError:
print("Error: can't find file or read data")
else:
print(repr("FILE").ljust(32), repr("SIZE").ljust(15), repr("DATE CREATED").ljust(30), end=" ")
print("\n")
for file in dirs:
print(repr(file).ljust(30), repr(os.stat(file).st_size).rjust(8), end=' ')
print("bytes", repr(time.ctime(os.path.getctime(file))).rjust(30))