def writel(length, file_name = ""):
if file_name!="":
f = open(file_name, "w")
f.write(str(length))
f.close()
else:
print(str(length))
writel(3, "FileName.txt")
I hope this helps!
Remember, you must have the file created prior to running this program. Best of luck.