I'm fairly new to python and object oriented programming in general, so I'm having a little trouble figuring out why this doesn't work
this is the error I'm getting for the code below:
Error: 'str' object has no attribute 'insert'
filetolist = FileReadToList("test.txt")
print filetolist[0]
def FileCountLines(s_filename):
f = open(s_filename)
filestring = f.read()
count = operator.countOf(filestring, "\n")
file.close(f)
return count
def FileReadToList(s_filename):
f = open(s_filename)
count = FileCountLines(s_filename)
filestring = f.read()
filestring.insert(0,count)
file.close(f)
return filestring