python learning exchange conversion and list the location of the string of essays -list

Today happens to be the junior partner to help write a little program to do a fixed position interchangeable eight string, "123b5c7a" to be replaced "7ac5b321"

Think of the use of string converted to list and then use the list to swap positions.

# -*- coding: utf-8 -*-
L2=["12908ad0","16005a79","160055f6"]
for i in L2:
    L1=list(i) 
    L1[0],L1[1],L1[2],L1[3],L1[4],L1[5],L1[6],L1[7]=L1[6],L1[7],L1[4],L1[5],L1[2],L1[3],L1[0],L1[1]
    s1=''.join(L1)
    print(sl)

Guess you like

Origin www.cnblogs.com/hokisang/p/12074410.html