how to use with open

Solutions on MaxInterview for how to use with open by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "how to use with open"
Giulia
13 Oct 2016
1with open('output.txt', 'w') as file:  # Use file to refer to the file object
2  file.write('Hi there!')
3# more down here
4# https://www.pythonforbeginners.com/files/with-statement-in-python
5