that is all the decoder_order, thank you all, it us none_seen code to 
encryption the origin order

__test = ['                                                                
                                                                           
','                                                                       
                                                                    ']
def decode_order(str_code):
    #origin_order = sel.xpath('//div[@class=a/li]')
    field = str_code.strip().split(" ")
    origin_order = range(1, len(field)+1)
    order = 100 * [0]
    tmp_order={}
    decode = None
    decode = []
    for field_seq in range(len(field)):
        binary_code = ""
        for field_pos in range(len(field[field_seq])):
            if field[field_seq][field_pos] == '\f':
                binary_code+='1'
            else:
                binary_code+='0'
        #print "field[field_seq]:|%r|" % field[field_seq]
        #print "binary_code:|%r|" % binary_code
        decode.append(int(binary_code,2))
    for field_seq in range(len(decode)):
        tmp_order[decode[field_seq]] = origin_order[field_seq]
    print "tmp_order.keys: ", tmp_order.keys()
    print "tmp_order.vals: ", [tmp_order[x] for x in tmp_order]
    for field_seq in range(1,len(field)+1):
        if field_seq in tmp_order.keys():
            order[field_seq] = tmp_order[field_seq]
        else:
            order[field_seq] = 0
    
    #print [x for x in order if x!= 0]
    order =  [x for x in order if x!= 0]
    print "rel_order.vals: ", order
    return order

decode_order(__test[0])
decode_order(__test[1])


#tmp_order.keys:  [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 
38, 39, 40, 41, 42]
#tmp_order.vals:  [11, 7, 34, 9, 26, 37, 31, 39, 6, 13, 2, 20, 42, 27, 22, 
24, 25, 29, 23, 21, 5, 32, 35, 18, 10, 41, 14, 3, 30, 40, 17, 8, 33, 16, 
28, 12, 19, 36, 38, 15]
#rel_order.vals:  [11, 7, 34, 9, 26, 37, 31, 39, 6, 13, 2, 20, 42, 27, 22, 
24, 25, 29, 23, 21, 5, 32, 35, 18, 10, 41, 14, 3, 30, 40, 17, 8, 33, 16, 
28, 12, 19, 36, 38, 15]
#tmp_order.keys:  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 
37, 38, 39, 40, 41, 42]
#tmp_order.vals:  [1, 38, 42, 6, 24, 21, 40, 39, 12, 28, 18, 31, 36, 34, 
32, 26, 11, 2, 20, 8, 27, 16, 3, 30, 37, 35, 25, 23, 22, 15, 10, 9, 41, 19, 
13, 5, 17, 33, 7, 14, 29]
#rel_order.vals:  [38, 42, 6, 24, 21, 40, 39, 12, 28, 18, 31, 36, 34, 32, 
26, 11, 2, 20, 8, 27, 16, 3, 30, 37, 35, 25, 23, 22, 15, 10, 9, 41, 19, 13, 
5, 17, 33, 7, 14, 29]




On Monday, May 19, 2014 10:12:02 PM UTC+8, jinchao wang wrote:
>
> [22:04] <moresec> http://shenzhen.8684.cn/x_04f068e2
> [22:05] <moresec> name_list = 
> sel.xpath('//div[@id="lms-station"]/ul[@class="lms-stationLf"]/li')
> [22:05] <moresec> and then , name_list is not original order from the 
> webpage
> [22:06] <moresec> scrapy shell http://shenzhen.8684.cn/x_04f068e2
> [22:06] <moresec> that is my test page
>
> thank you for you paintent
>

-- 
You received this message because you are subscribed to the Google Groups 
"scrapy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to scrapy-users+unsubscr...@googlegroups.com.
To post to this group, send email to scrapy-users@googlegroups.com.
Visit this group at http://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to