习题001

 

SRC_DIR=/SBIDATA
DEST_DIR=/SBIBAEOO1

BAK_DATE=$(date +%Y%m%d)
mkdir ${DEST_DIR}/${BAK_DATE}

cd ${SRC_DIR}
find . -type f -size +10k -exec mv {} ${DEST_DIR}/${BAK_DATE} \;

 

 

 

 

 

 

 

# list_test = [{"day":1,"no":101},
#              {"day":2, "no": 301},
#              {"day":3, "no": 3},
#              {"day":1, "no": 401},
#              {"day":3, "no": 201},]
# list_new = list(list_test)

# for  match in list_test:
#     if match["no"]<=300:
#         match["type"]="FB"
#     else:
#         match["type"] = "BK"

# list_new[1]["day"]=7
# list_new.pop()
'''
# print(list_test)
执行结果:
[{'day': 1, 'no': 101, 'type': 'FB'},
 {'day': 7, 'no': 301, 'type': 'BK'},
{'day': 3, 'no': 3, 'type': 'FB'},
{'day': 1, 'no': 401, 'type': 'BK'},
{'day': 3, 'no': 201, 'type': 'FB'}]
# print(list_new)
执行结果:
[{'day': 1, 'no': 101, 'type': 'FB'},
 {'day': 7, 'no': 301, 'type': 'BK'},
{'day': 3, 'no': 3, 'type': 'FB'},
{'day': 1, 'no': 401, 'type': 'BK'}]
'''

 

# 写一个算法,将字符串列表["aycc","kh","llc","u","l"]通过算法处理为["y","k","c","u","l"],
# 对调字符列表中的字符位置("y"与"l"对调,"k"与"u"对调),并拼接字符列表中的字符,输出字符串"LUCKY".
def word_join(l):
    for i in l:
        if i.count("c")==1:
            l[l.index(i)]="c"
    s =[]
    for j in l:
        j = list(j)
        j.sort(reverse=True)
        s.append(j[0])
    s[0],s[-1]=s[-1],s[0]
    s[1],s[-2]=s[-2],s[1]
    s = "".join(s).upper()
    return s
print(word_join(l))




def test(l):
    new_lst = []
    new_lst.append(l[0][1])
    new_lst.append(l[1][0])
    new_lst.append(l[2][-1])
    new_lst.append(l[3][0])
    new_lst.append(l[4][0])
    new_lst[0],new_lst[-1]=new_lst[-1],new_lst[0]
    new_lst[1],new_lst[-2]=new_lst[-2],new_lst[1]
    s = "".join(new_lst).upper()
    return s
print(test(l))

 

posted @ 2019-07-13 17:12  小萍瓶盖儿  阅读(156)  评论(0)    收藏  举报