I suggest
def touch(filename):
os.close(os.open(filename, os.O_WRONLY | os.O_CREAT, int("666", 8)))
os.utime(filename, None)
def load(filename = 'Database.csv'):
if not os.access(filename, os.F_OK):
touch(filename)
with open(filename, 'rb') as ifh:
return list(list(row) for row in csv.reader(ifh))
Also, for your safety, indent python code with 4 spaces, no tab characters, and avoid module commands which is deprecated.
Gribouillis
Posting Maven
2,786 posts since Jul 2008
Reputation Points: 1,044
Solved Threads: 691