',
}
# 请求头和cookies
headers = {
'User-Agent': random.choice(user_agent_list),
'Referer': 'https://www.baidu.com/',
'Connection': 'keep-alive',
'Accept-Encoding': 'gzip, deflate, sdch, br',
}
cookies = {
'Cookie': 'uuid=5A7BA8F2B58B11E79BBD5B4242FDBCBFE6154F87898F497DBCA6509D54A7A6C0; gr_user_id=525728d9-2b2f-4bb9-b365-8a510d9c7216; UM_distinctid=15e9d5a0fe3a63-0d9d7bce00af2b-5e442e19-100200-15e9d5a0fe4b4e; __mta=218953415.1526892123814.1526892123814.1526892123814.1; tt_webid=6563014265005483534; WEATHER_CITY=北京; tt_webid=6563014265005483534; csrftoken=0dc2d6729392c28f1d0f802a55737f2e; s_v_web_id=553c0ed4b3bdb12ac4be5c4265b1e5f9; _ga=GA1.2.1246598504.1526892142; _gid=GA1.2.1375920225.1526892142',
}
# 使用post请求
response = requests.post(url=translate_url, data=data, headers=headers, cookies=cookies)
# 将json数据解析
result = json.loads(response.text)
# 提取翻译后的文本
result_content = result['trans_result']['dst']
# 打印翻译结果
print(result_content)