[Tutor] running split and count + looping to check for numbers in same line

jim serson fubarninja at hotmail.com
Thu Feb 11 00:43:31 CET 2010

I am getting an error when I try and run split and count I seem to get it to work with one or the other but not together. python wants a character buffer but I am not sure how to use it. 


I would also like to use readline to check and see if several numbers are in the same line but I think I will need to use it in a loop maybe for? So it would check for the first then check for the second if both are true add to count but if ether are false continue to next line and repeat.


If anyone can help me that would be grate.


look_in = "keno_back_up.txt"#raw_input ("Enter the search file to look in ")
search = raw_input ("Enter your search item ").split

file = open(look_in, "r").read().count(search)

print "Your search came",file ,"times"

Traceback (most recent call last):
  File "C:\Python26\keno program\get rid of 4", line 4, in <module>
    file = open(look_in, "r").read().count(search)
TypeError: expected a character buffer object

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100210/9d0b093a/attachment.htm>

More information about the Tutor mailing list