keys=['name','age']
values=['lds',33]
#获取list
list_obj=list(zip(keys,values))
#list排序
list_obj=sorted(list_obj,key=lambda n:n[0])
print(list_obj)
#转换为url连接字符串
url_str=""
pattern_str="{0}={1}"
for i in list_obj:
url_str+=pattern_str.format(i[0],i[1])+'&'
url_str =url_str[0:len(url_str)-1]
print(url_str)

#获取dictionary
dict_obj=dict(zip(keys,values))
print(dict_obj)
posted on 2019-06-20 20:20  天0涯  阅读(1632)  评论(0编辑  收藏  举报