[ create a new paste ] login | about

Link: http://codepad.org/hXWSl0YX    [ raw code | fork ]

nevets04 - Plain Text, pasted on Nov 20:
#Code:
class doc:
    def write(self,a,b):
        f = open(a,'w')
        f.write(b)
    def read(self,a):
        f = open(a,'r')
        for line in f:
            print line
    def append(self,a,b):    
        f = open(a,'a')
        f.write(b)

doc = doc()


#Usage:

#doc.read(filename)
#doc.write(filename,text)
#doc.append(filename,text to add to file)

#Example:

#Code:
#from doc import *
#doc.write("test.txt","Test 1")
#doc.read("test.txt")

#Code:
#from doc import *
#doc.append("test.txt","Hi")
#doc.read("test.txt")



Create a new paste based on this one


Comments: