how to extract columns like awk $1 $5

Roy Smith roy at panix.com
Fri Jan 7 16:42:36 EST 2005


In article <mailman.310.1105118153.22381.python-list at python.org>,
Anand S Bisen  <vmlinuz at abisen.com> wrote:
>Hi
>
>Is there a simple way to extract words speerated by a space in python 
>the way i do it in awk '{print $4 $5}' . I am sure there should be some 
>but i dont know it.

Something along the lines of:

words = input.split()
print words[4], words[5]



More information about the Python-list mailing list