国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

傻瓜讀書軟件在升級(III)

2020-03-04 20:43 作者:一心想當網(wǎng)紅的李老師  | 我要投稿

這次案件只有一個了。

再大神的指導(dǎo)下,成功分析了文件類型,然后選擇了合適的處理方式。目前可以處理txt和word文件。感覺又有了提高。

代碼如下:(python3.7版本)

#! /usr/bin/env python

# -*- coding: utf-8 -*-

import importlib,sys

importlib.reload(sys)


import tkinter

from tkinter.filedialog import askopenfilename

from docx import Document

from docx.shared import Inches

import pyttsx3

import os


l=[]

def openfile():

? ? file_path=askopenfilename()

? ? if os.path.splitext(str(file_path))[1]=='.txt': ? ?###利用os模塊的功能,成功分解文件的后綴

? ? ? ? f=open(file_path,encoding='utf-8')

? ? ? ? fread=f.read()

? ? ? ? f=str(fread)

? ? ? ? engine=pyttsx3.init()

? ? ? ? engine.say(f)

? ? ? ? engine.runAndWait()

? ? elif os.path.splitext(str(file_path))[1]=='.docx':

? ? ? ? f=Document(file_path)

? ? ? ? for para in f.paragraphs:

? ? ? ? ? ? l.append(para.text)

? ? ? ? engine=pyttsx3.init()

? ? ? ? engine.say(str(l))

? ? ? ? engine.runAndWait()



top=tkinter.Tk()

Button1=tkinter.Button(top, text ="選擇文件", command = openfile)

Button1.pack()

top.mainloop()

雖然不是非?,F(xiàn)代化,但是更加進步了一下。后續(xù)繼續(xù)升級改造。

傻瓜讀書軟件在升級(III)的評論 (共 條)

分享到微博請遵守國家法律
山阳县| 巴青县| 南丰县| 镇坪县| 苏尼特右旗| 昭觉县| 缙云县| 鄂州市| 涟水县| 炎陵县| 隆昌县| 柏乡县| 宿松县| 高州市| 开江县| 华阴市| 临夏市| 饶平县| 蒙山县| 龙山县| 中牟县| 延津县| 南靖县| 仙居县| 邵东县| 扶沟县| 凭祥市| 桃江县| 马鞍山市| 于都县| 扬州市| 林西县| 新平| 巧家县| 合川市| 胶州市| 松原市| 文化| 元阳县| 平原县| 攀枝花市|