python 자동화 인터페이스 테스트(바 이 두 번역)
2831 단어 Python
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import requests
import sys
url="http://fanyi.baidu.com/v2transapi"
params={
"from":"en",
"to":"zh",
"query":"test"
}
r=requests.request("post",url,params=params)
#print(r.text)
import json
d=json.loads(r.text)
c=d['liju_result']['tag']
c_convert=''.join(c)
list=list(c_convert)
msg=repr([x.encode(sys.stdout.encoding)for x in c]).decode('string -escape')# encode list
print c
print c_convert
print msg
print list
[u'\u8bd5\u9a8c', u'\u6d4b\u9a8c', u'\u8003\u9a8c', u'\u5316\u9a8c', u'\u8003\u67e5', u'\u53d7\u8bd5\u9a8c', u'\u53d7\u6d4b\u9a8c', u'\u53d7\u8003\u9a8c', u'\u6d4b\u5f97\u7ed3\u679c']
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
[u'\u8bd5', u'\u9a8c', u'\u6d4b', u'\u9a8c', u'\u8003', u'\u9a8c', u'\u5316', u'\u9a8c', u'\u8003', u'\u67e5', u'\u53d7', u'\u8bd5', u'\u9a8c', u'\u53d7', u'
\u6d4b', u'\u9a8c', u'\u53d7', u'\u8003', u'\u9a8c', u'\u6d4b', u'\u5f97', u'\u7ed3', u'\u679c']
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Python의 None과 NULL의 차이점 상세 정보그래서 대상 = 속성 + 방법 (사실 방법도 하나의 속성, 데이터 속성과 구별되는 호출 가능한 속성 같은 속성과 방법을 가진 대상을 클래스, 즉 Classl로 분류할 수 있다.클래스는 하나의 청사진과 같아서 하나의 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.