fp=open('d:/test.txt','w')
print('HelloWord',file=fp)
fp.close()
with open('d:/test.txt','w') as file:
file.write('HelloWord1')
fp=open('d:/test.txt','w')
print('HelloWord',file=fp)
fp.close()
with open('d:/test.txt','w') as file:
file.write('HelloWord1')