[Tutor] raw_input()

Alan Gauld alan.gauld at btinternet.com
Tue Mar 16 02:11:23 CET 2010


"kumar s" <ps_python at yahoo.com> wrote

> For example:
>
> x1.py  =
>
> second = raw_input()
> x =  second.split('\t')
> y = x[1:]
> print '\t'.join(y)
>
>
> %cat mybigfile.rod | python x1.py
> chr1    433     433     rs56289060      0 
> +       -       -       -/C     genomic insertion       unknown 0       0 
> unknown between 1
>
>
> My question:
>
> this program is only printing first line. It is not processing every line 
> that cat spits to x1.py.
> how do I print every line.

You need to read every line.

But since you appear to be on Unix have you looked at the cut command
which would appear to do what you want directly?

Unless you just want the learning experience.


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list