Why not create a dict with the id of your data and update the key with the
other data of the other table??

Something like this :

dict123 = {}
for r in cleavage_res:
    dict123[r[0]]=[r[1:]]

Then

for r in thmmdata:
    dict123[r[0]].append(r[3])  # if position is not important
    # or
    # dict123[r[0]].insert(2, r[3])  # if postion is important

Richard


On Tue, Nov 12, 2013 at 12:06 PM, sonu kumar
<[email protected]>wrote:

> cleavage_res contains:
> 10GSPAR-PRRLP
>
>
>
>
>
> 972.48117361.5013ARPRR-LPLLS
>
>
>
>
> 1381.73116952.2518LPLLS-VLLLP
>
>
>
>
> 1905.05116428.9323VLLLP-LLGGT
>
>
>
>
> 2440.41115893.57
>
> thmmdata contains:
>
> 10
>
>
>
>
> iiiiiiiMMM
>
> 13
>
>
>
>
>
> oooooooooo
>
> 18
>
>
>
>
>
> MMMMMMMM
>
> 23
>
>
>
>
>
> MMMiiiiiiii
>
>
> now I would like to present all data in one table like this:
>
> 10GSPAR-PRRLP
> iiiiiiiMMM
>
>
>
>
> 972.48117361.5013ARPRR-LPLLS
> oooooooooo
>
>
>
> 1381.73116952.2518LPLLS-VLLLP
> MMMMMMMM
>
>
>
> 1905.05116428.9323VLLLP-LLGGT
> MMMiiiiiiii
>
>
>
> 2440.41115893.57
>
>
>
>
> On Monday, 11 November 2013 19:18:03 UTC-8, Leonel Câmara wrote:
>>
>> This is kind of impossible to answer without knowing what's in row or
>> thmdata, It could be simply an error in your parser (you say the data comes
>> from parsed files), and it's not getting all the results you were
>> expecting.
>>
>> I suggest you use the debugger included with the framework to inspect the
>> variables and see what's happening.
>>
>> I also suggest you use css instead of font tags.
>>
>> Segunda-feira, 11 de Novembro de 2013 23:57:32 UTC, sonu kumar escreveu:
>>>
>>> Hi,
>>>
>>> I am trying to print my data in table from two parsed files in view :
>>> here is my code:
>>>
>>> <table >
>>> <thead>
>>> <tr>
>>>     <th>P1<br>position</th>
>>>      <th>residue</th>
>>>     <th>Transmembrane<br>domain</th>
>>>     <th>C-mass</th>
>>> </tr>
>>> </thead>
>>> {{for row in cleavage_res[2:]:}}
>>> <tbody>
>>> <tr  class="gradeA">
>>>     <td>{{=row[0]}}</td>
>>>     <td><font face="Courier">{{=row[1]}}</font></td>
>>>     <td>
>>>         {{for thm in thmmdata:}}
>>>         {{if row[0] == thm[0]:}}
>>>         <font face="Courier">{{=thm[2]}}</font>
>>>         {{pass}}
>>>         {{pass}}
>>>     </td>
>>>     <td>{{=row[8]}}</td>
>>> </tr>
>>>  {{pass}}
>>> </tbody>
>>> </table>
>>>
>>> The problem I am facing in result output is:
>>> third column prints first value after matching and further on it is
>>> blank, although there are matching available for 13 and 18..
>>> Second loop is trying to fetch data from thmmdata which are similar to
>>> row[0] and thm[0]. please help me out where I am doing wrong?
>>>
>>>
>>> 10GSPAR-PRRLP
>>>
>>>
>>>
>>> iiiiiiiMMM972.48117361.5013ARPRR-LPLLS
>>>
>>>
>>>
>>>
>>> 1381.73116952.2518LPLLS-VLLLP
>>>
>>>
>>>
>>>
>>> 1905.05116428.9323VLLLP-LLGGT
>>>
>>>
>>>
>>>
>>> 2440.41115893.57
>>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to