Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This code will produce the output you want. Maybe not the best way, but seems to work as expected.</p> <pre><code>#data = [ #'offspr84 175177 200172 312312 310326 338342 252240 226210 113129 223264', #'male28 197175 172200 308312 310338 262338 256252 190226 113129 223219', #'female13 197177 172172 312308 318326 342350 240248 210218 129113 267247'] data = [ 'offspr85 181177 192160 320312 290362 358330 238238 214178 133129 263223', 'male65 197181 176192 320268 322286 358330 238244 206214 137133 267263', 'female17 181177 160172 280312 362346 350326 230238 126178 129129 223167' ] for i, line in enumerate(data): data[i] = line.split(' ') for item in data[0]: if data[1].count(item) &gt; 0: print data[0][0], item print data[1][0], item if data[2].count(item) &gt; 0: print data[0][0], item print data[2][0], item </code></pre> <p>Update:</p> <p>With a nested list to include both list at once:</p> <pre><code>datas = [[ 'offspr85 181177 192160 320312 290362 358330 238238 214178 133129 263223', 'male65 197181 176192 320268 322286 358330 238244 206214 137133 267263', 'female17 181177 160172 280312 362346 350326 230238 126178 129129 223167' ], [ 'offspr84 175177 200172 312312 310326 338342 252240 226210 113129 223264', 'male28 197175 172200 308312 310338 262338 256252 190226 113129 223219', 'female13 197177 172172 312308 318326 342350 240248 210218 129113 267247'] ] for data in datas: for i, line in enumerate(data): data[i] = line.split(' ') for data in datas: for item in data[0]: if data[1].count(item) &gt; 0: print data[0][0], item print data[1][0], item if data[2].count(item) &gt; 0: print data[0][0], item print data[2][0], item </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload