You cannot find the position of the text in the file unless you open the file. It's like asking someone to read a newspaper without opening their eyes.
To answer the first part of your question, this is relatively simple.
with open('Path/to/file', 'r') as f:
content = f.read()
print content.index('test')
source
share