[Tutor] How to group data?

tee chwee liong tcl76 at hotmail.com
Mon Feb 14 01:03:55 CET 2011


> How about some clues as to what you're trying to accomplish? This code 
> is surprisingly verbose, and probably totally wrong. Anyway, each time 
> you pop an item from the list, all the following ones change their 
> index. So presumably there weren't still 79 items in the list by the 
> time you had removed and shuffled a bunch of them. You don't indicate 
> how many times it went around the outer loop, but in any case, there 
> won't be enough values the last time around.
> 

sorry for the confusion. i'm trying to get:
>>> 
ROW1=1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ROW2=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ROW3=XX11111X11XXXXX11XXXXXX1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ROW4=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0XXXXXXXXXX1XXXXXXXXXXXX111111XXXX
 
whereby it will group the last column in the data file into each row with 128 characters in reverse order. for eg: in data below and if i group it into 4 characters in a row in reverse order will be:
 
row1=XX11
row2=XXXX
row3=XXXX
row4=00XX
 
0 BC_4 SYSCLK_DN observe_only 1
1 BC_4 SYSCLK_DP observe_only 1
2 BC_4 QPI3_DRX_DN 19 input X
3 BC_4 QPI3_DRX_DP 19 input X
4 BC_4 QPI3_DRX_DN 18 input X
5 BC_4 QPI3_DRX_DP 18 input X
6 BC_4 QPI3_DRX_DN 17 input X
7 BC_4 QPI3_DRX_DP 17 input X
8 BC_4 QPI3_DRX_DN 16 input X
9 BC_4 QPI3_DRX_DP 16 input X
10 BC_4 QPI3_DRX_DN 15 input X
11 BC_4 QPI3_DRX_DP 15 input X
12 BC_4 QPI3_DRX_DN 14 input X
13 BC_4 QPI3_DRX_DP 14 input X
14 BC_4 QPI3_DRX_DN 13 input 0
15 BC_4 QPI3_DRX_DP 13 input 0
  		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110214/e0f19577/attachment-0001.html>


More information about the Tutor mailing list