You have used code of dump like next line. I think that it is too much learning to junior. What do you think about?
with conn:
with open('/Users/asd/Desktop/python_basic/dump.sql', 'w') as f:
for line in conn.iterdump():
f.write('%s\n' % line)
print("Complete Dump, Good job!")
And! Using 'with:', I shouldn't write 'conn.close()' or 'open.close()'🙄?