我是新手:)
我需要将这个简单的列表转换为字典:
F[i] + L[j_i] >= K
输出将为[('Host', '127.0.0.1:8000'), ('Connection', 'keep-alive'), ('Cache-Control', 'no-cache'), ('Test_data_Header_Key', 'Test_Data_Header_value'), ('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'), ('Postman-Token', '3b17e573-90d6-e5fe-26cb-a9488f9b22e0'), ('Accept', '*/*'), ('Accept-Encoding', 'gzip, deflate, sdch, br'), ('Accept-Language', 'en-US,en;q=0.8,bn;q=0.6')]
感谢您的建议。感谢。
答案 0 :(得分:3)
dict
构造函数已经为您执行此操作:
dict([('Host', '127.0.0.1:8000'), ('Connection', 'keep-alive'), ('Cache-Control', 'no-cache'), ('Test_data_Header_Key', 'Test_Data_Header_value'), ('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'), ('Postman-Token', '3b17e573-90d6-e5fe-26cb-a9488f9b22e0'), ('Accept', '*/*'), ('Accept-Encoding', 'gzip, deflate, sdch, br'), ('Accept-Language', 'en-US,en;q=0.8,bn;q=0.6')])