[Tutor] List action
kumar s
ps_python at yahoo.com
Sun Oct 3 16:49:15 CEST 2004
Dear group,
I have a file with p-values, q-values and rank
seperated by a white space:
0.000100848 0.02449766 1
0.000109613 0.02608342 1
0.000113775 0.02653233 1
0.000143877 0.03273097 1
My goal is to write a python program that takes this
file and write a tab delimited text with p-value \t
q-value \t rank \t.
My Logic:
take this raw file and make a list.
list1[1] = ['0.000100848 0.02449766 1','0.000109613
0.02608342 1','...','...',...... ]
>for i in list1:
q = i.split()
print q
> q
['0.000143877', '0.03273097', '1']
I wanted to get the all elements in another variable.
I wrote a function that looks like following:
>>> def element(x):
for i in x:
i.split()
>>> k = element(qval)
>>> k
I get nothing in this K. It is empty.
After this I have no idea.
My question:
1. Why I am not getting anything into k. Is my
function element screwed up in definition.
2. After getting a file with all lists in a format
like this:
['0.000100848', '0.02449766', '1']
['0.000109613', '0.02608342', '1']
['0.000113775', '0.02653233', '1']
['0.000143877', '0.03273097', '1']
['0.00014597', '0.03273097', '1']
['0.000149585', '0.0329087', '1']
['0.000159045', '0.03434194', '1']
['0.000176115', '0.03696072', '1']
How do I write each element into a tab delimited text
file.
Can any one please help me.
Thank you in advance
Kumar
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
More information about the Tutor
mailing list