相关疑难解决方法(0)

GoogleTrans API错误 - 期望值:第1行第1列(字符0)

我在迭代中翻译数千个文本数据时遇到此错误:

Expecting value: line 1 column 1 (char 0)
Run Code Online (Sandbox Code Playgroud)

我翻译大量文本的代码:

translatedList = []
for index, row in df.iterrows():
    newrow = copy.deepcopy(row)
    try:
        # translate the 'text' column
        translated = translator.translate(row['text'], dest='en')
        newrow['translated'] = translated.text
    except Exception as e:
        print(str(e))
        continue
    translatedList.append(newrow)
Run Code Online (Sandbox Code Playgroud)

翻译大约2-3k行后,我收到此错误.

python google-translate

11
推荐指数
3
解决办法
1万
查看次数

标签 统计

google-translate ×1

python ×1