1. 如果是文档类转换的话, 可以借助 pypandoc模块(pip install pypandoc)
import pypandoc
out = pypandoc.convert_file('a.txt', 'docx', outputfile = 'a.docx') # 转为docx
2. 如果是图片或者视频类的转化的话, 可以使用 opencv
import cv2
img = cv2.imread('a.jpg')
out = cv2.imwrite('a.png', img) # jpg转png