python3使用ltp语言云
text="我爱自然语言处理。"
text=str(text)
#text=urllib.quote(text)
text=urllib.parse.quote(text)
def test1():
pattern = 'ws'
url = 'http://ltpapi.voicecloud.cn/analysis/?' \
'api_key=youkey' \
'&text='+text+\
'&pattern='+pattern+\
'&format=plain';
response = request.urlopen(url)
content = response.read().decode('utf-8')
print(content)
test1()
python3没有了urllib.quote(text)
需使用urllib.parse.quote(text)