vim --> python

Gerhard Häring gh at ghaering.de
Sun Jul 6 10:19:14 EDT 2003


Andreas Steffen wrote:
> Hi,
> how can I adress the lines, which I send as input from vim to a python
> script (in python):
> 
> for example - :1,10!python script.py

For this filter, read from sys.stdin and write to sys.stdout. Btw. the 
print statements writes to sys.stdout as well.

> Probably the same problem:
> how can I adress something which is piped into a python script?
> cat text.txt | python script.py

Yup, same problem. Use sys.stdin/sys.stdout.

-- Gerhard





More information about the Python-list mailing list