Sponsored By

adisharma

What's the exact syntax of Python I/O file?

Recommended Posts

Can anyone tell me is it right syntax?

For Open:

f = open("file name", file_mode) f is file object

f = open("file.txt", w)

For Close:

f = open("file.txt",'w')

f.close() # close a file

If it does not then tell me the exact syntax of how to create it. I just see this same syntax to the other side here but when I coded it's not working. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now