五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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)的評論 (共 條)

分享到微博請遵守國家法律
靖安县| 桐柏县| 富蕴县| 罗田县| 黎川县| 凌海市| 佛教| 柳州市| 盐城市| 叶城县| 兴和县| 丽水市| 江陵县| 益阳市| 新津县| 广南县| 祥云县| 高淳县| 惠水县| 通海县| 历史| 舟曲县| 称多县| 吉木乃县| 科技| 安阳县| 高淳县| 青龙| 比如县| 仁寿县| 耒阳市| 灌南县| 古丈县| 富锦市| 武胜县| 东明县| 武强县| 施秉县| 常山县| 分宜县| 巢湖市|