-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfilechooser.py
31 lines (30 loc) · 929 Bytes
/
filechooser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import tkinter as tk
from tkinter import Tk
from tkinter.filedialog import askopenfilenames
from docx_to_txt import convert_to_txt
def multfile():
Tk().withdraw()
files = askopenfilenames(filetypes=(("txt", "*.txt"),("docx", "*.docx")))
files = list(files)
finalf = []
temp = []
if files[0].endswith(".docx"):
temp = convert_to_txt(files)
for i in range(len(temp)):
string = temp[i]
ind = 0
for j in range(len(string)):
if string[j]=='/':
ind = j
string = string[ind+1:]
finalf.append(string)
else :
for i in range(len(files)):
string = files[i]
ind = 0
for j in range(len(string)):
if string[j]=='/':
ind = j
string = string[ind+1:len(string)]
finalf.append(string)
return finalf