I want to read a file and when the file changed (i.e. for a external program), print the new information readed.
Something like this:

```
import sys, os

with open('file.txt', 'r') as f:
    fid = f.fileno()
    r = os.fdopen(fid)
    while True:
        print r.read() 

```

And when I do:

```
echo "Hello world!" > file.txt

```

The python script show:

```
> Hello world!

```

Many thanks.

---

EDITED:
The solution:

```
time = os.path.getmtime('file.txt')
while True:
    if (time <> os.path.getmtime('file.txt')):
        with open('file.txt', 'r') as f:
            info = f.read()
            print "Readed: " + info
        time = os.path.getmtime('file.txt')

```