LINUX.ORG.RU

Reply- Python I / O File

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:

f = open(«test.txt») # open file in current directory 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:

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

lokeshjoshi1993 ()