Jump to content
Fórum Script Brasil
  • 1
Sign in to follow this  

How to Create Python I/O File


Hello Guys, Can anyone tell me what is the exact syntax of python I/O file format? IF anyone knows please provide me syntax.

Share this post

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 1

Hi Arjun,

Here is the command through you can create a file just write this below given code for opening a file then execute it:

  1. >>> f = open("test.txt") # open file in current directory
  2. >>> f = open("C:/Python33/README.txt") # specifying full path

Here is the complete steps through you can create a file in Python:

Step 1:

f= open("scriptbrasil.txt","w+")

Step 2:

for i in range(10):
     f.write("This is line %d\r\n" % (i+1))

Step 3: 


To know it more in detailed way or other command i.e. append data, Read file click here.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...