0

I want to read a .txt file in python and then find a specific word in it and print content up to certain length .

I tried reading using

f = open("file.txt", "r")
f.read()
f.find("xx")

// this returns value -1

suppose my file is like this

'naba:12:naba, xyz:13:xyz, xxx:23:cww'

and I want to read and Print the content between two naba:

Amit Verma
  • 40,709
  • 21
  • 93
  • 115
Nabz C
  • 538
  • 1
  • 9
  • 28
  • Have you checked this [link](http://stackoverflow.com/questions/4940032/search-for-string-in-txt-file-python)? – Jigar Mistry Nov 23 '14 at 04:53
  • You are reading from the file and not storing it in a string buffer. Read from a file, store in a string and then call string method find() – helloV Nov 23 '14 at 04:55

0 Answers0