[Tutor] please help: conditional statement and printing element

kumar s ps_python at yahoo.com
Tue Jan 11 20:55:54 CET 2005


Dear group, 
  For some reason my brain cannot think of any other
option than what I have in my script. Could any one
please help me in suggesting.

What I have : (File name : psl)
22	2	457:411	25	0
25	0	457:411	25	0
25	0	457:411	25	0
25	0	457:411	25	0
25	0	457:411	25	0
25	0	457:411	25	0
25	0	457:411	25	0
25	0	457:411	25	0
25	0	457:411	25	0
22	0	457:411	25	0
25	0	457:411	25	0
25	0	457:411	25	0
24	1	457:411	25	0
22	0	457:411	25	0
21	0	457:411	25	0
25	0	457:411	25	0
25	0	457:411	25	0


What to do:
I want to print values that are 25 in column 1 and not
the other values such as 24,22,21 etc.


My script:
>>> for i in range(len(psl)):
	col = split(psl[i],'\t')
	col1 = col[0]
	if col1 == 25:
		print col[0]+'\t'+col[1]+'\t'+col[17]


>>>

Result: I get nothing. Am I doing something very
wrong. Why isnt if col1 == 25: functional. 

My idea is to check if col[0] == 25: then print
columns 1,18 etc. 

Can you please help me. 

Thanks
K

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Tutor mailing list