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

thanks, that worked, why does that make a difference?
I'd like to understand exactly what is going on.

The readlines() file method returns a list. The read() method returns a string. A str object has no insert() method but a list object does.

This question has already been answered. Start a new discussion instead.