1、若有兩個list,分別爲:python
a = [1,2,3,4,5,6]
b = ["a","b","c","d","e","f"]
用python來實現 ['a1', 'b2', 'c3', 'd4', 'e5', 'f6'] 的格式,如何實現呢?
下面我用列表推導式來實現
db = [str(x) +str(y) for x,y in zip(b,a)]
print(db)
2、實現對兩個字符串進行拼接,而後進行以A -- >Z ,再 a-->z 的順序排序blog
a = "awfesdafhjkcasadckjsdackjsadvcnksausafdsch"
b = "SufhwrifjiEIJFDIEJDIej"
list1 = list(a+b)
list2 = sorted(list1)
print(''.join(list2))