【问题标题】:AWS reading utf-8 file pycaption.detect_format returns NoneAWS 读取 utf-8 文件 pycaption.detect_format 返回 None
【发布时间】:2021-01-25 19:22:07
【问题描述】:

Python 版本:3.5-slim-buster 模块:pycaption

在读取从 s3 存储桶中编码为 us-ascii 的标题 .srt 时:

obj.get()['Body'].read()
print(pycaption.detect_format(body.decode()))

我得到了想要的回应

<class 'pycaption.srt.SRTReader'> 

但是在读取 utf-8 编码的 s3 .srt 文件时

pycaption 无法检测格式响应:

None

我试过了:

obj.get()['Body'].read().decode('utf-8')

print(pycaption.detect_format(body))

但没有运气

【问题讨论】:

    标签: python-3.x amazon-s3 pycaption


    【解决方案1】:

    最后问题出在我转换为 DOS 换行符 CR/LF 的 DOS 换行符 CR/LF 中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-02
      • 1970-01-01
      • 1970-01-01
      • 2018-10-15
      • 1970-01-01
      相关资源
      最近更新 更多