If you want to do some python calls without compiling vim with the python interpreter (that would allow you to write plug-ins in Python, and it's also needed for Omnicomplete anyway) you can try as this:
:.!python -c "import os; print os.getcwd()"
That would tell you where you are in the drive (current path).
Now let's number a few lines, starting from an empty file so we can see the result easily:
:.!python -c "for i in range(1,101): print i"
(vim numbers lines from 1 not 0)
Now we have just the number of each line in every line up to line 100.
Let's now put a small script in your current path (as shown above) and run it, see how it works. Let's copy paste this silly one. In reality you will find most useful to do script that output one line per line, but you don't have to do that as this script shows:
print "hi"
try:
while True:
i=raw_input()
print "this was:",i
except EOFError:
print "bye"
So you can call, for instance (imagine you called it "what.py"):
:10,20!python what.py
(Note that tab completion of file names works, so you can verify it's actually in the path)
As you can see, everyline is fed to the script as standard input. First it outputs "hi", at the end "bye" and in between, for each line you output "this was: " plus the line. This way you can process line-by-line. Notice you can do more complex stuff than processing line by line, you can actually consider previous lines. For such stuff I'd rather import sys and do it like this:
import sys
print "hello"
for i in sys.stdin.readlines():
i = i.rstrip("\n") # you can also prevent print from doing \n instead
print "here lyeth",i
print "see you"
Hope that helps.