create a file in a specific directory

Solutions on MaxInterview for create a file in a specific directory by the best coders in the world

showing results for - "create a file in a specific directory"
Alonso
27 Feb 2018
1# create a text file for writing
2with open(r'E:\pynative\reports\profit.txt', 'w') as fp:
3    fp.write('This is first line')
4    pass
5