标识中的字符无效
本帖最后由 juhugufudu 于 2020-4-1 08:07 编辑from aip import AipSpeech
print("a")
APP_ID = '19176425'
API_KEY = 'c4beaYPEzCk9e5TDaBIyPiHG'
SECRET_KEY = 'vuIwrKBPE1yLm0zdqO7ws9AcMZr91ltG'
print("-----0----")
client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)
print("-----1-------")
result = client.synthesis('你好百度', 'zh', 1, {'vol': 5,})
# 识别正确返回语音二进制 错误则返回dict 参照下面错误码
if not isinstance(result, dict):
with open('auido.mp3', 'wb') as f:
f.write(result)
这个的模块我都安装好了,但运行一开始就报错,显示“标识中的字符无效”
这个第一行就报错了,我也不知道为什么,网上搜的是什么隐藏字符……
这个是百度AI开放平台的,信息是没错的,缩进也调整了……但还是这样,代码本身有问题吗……谢谢回答 顺便说一下,这个是python3.8,是不是版本号的问题~~ 你程序注释前的&是什么意思,如果去掉之后,在我这里是可以运行的。
from aip import AipSpeech
print("a")
APP_ID = '19176425'
API_KEY = 'c4beaYPEzCk9e5TDaBIyPiHG'
SECRET_KEY = 'vuIwrKBPE1yLm0zdqO7ws9AcMZr91ltG'
#8203;
print("-----0----")
client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)
#8203;
print("-----1-------")
result = client.synthesis('你好百度', 'zh', 1, {'vol': 5,})
#8203;
# 识别正确返回语音二进制 错误则返回dict 参照下面错误码
if not isinstance(result, dict):
with open('auido.mp3', 'wb') as f:
f.write(result)
溪水叮咚 发表于 2020-3-31 13:17
你程序注释前的&是什么意思,如果去掉之后,在我这里是可以运行的。
这个是整行都乱码了 永恒的蓝色梦想 发表于 2020-3-31 13:47
这个是整行都乱码了
什么意思,能说的详细点吗? 溪水叮咚 发表于 2020-3-31 13:58
什么意思,能说的详细点吗?
你就把这个当不存在,全删掉就好了 永恒的蓝色梦想 发表于 2020-3-31 13:59
你就把这个当不存在,全删掉就好了
那就没问题,不信你把它删掉试试 第 7、10、13 行代码是什么意思?
应该把他删掉。
在 Python 中没有这样的语法。
而且你是不是说错了,我报的错是这一行:
from aip import AipSpeech
APP_ID = '19176425'
API_KEY = 'c4beaYPEzCk9e5TDaBIyPiHG'
SECRET_KEY = 'vuIwrKBPE1yLm0zdqO7ws9AcMZr91ltG'
client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)
result = client.synthesis('你好百度', 'zh', 1, {'vol': 5,})
# 识别正确返回语音二进制 错误则返回dict 参照下面错误码
if not isinstance(result, dict):
with open('auido.mp3', 'wb') as f:
f.write(result)
页:
[1]