1
2
3
4
5
6
7
8
9
10
11
12
13 import os
14 import re
15 import string
16
18 """ Return the word without excessive blank spaces, underscores and
19 characters causing problem to exporters"""
20 word = re.sub("^[^\w]+","",word)
21 word = re.sub("[^\w]+$","",word)
22 word = re.sub("_+","_",word)
23 word = re.sub("^[^\w]+","",word)
24
25
26 dict = '&[];"*:,'
27 for letter in dict:
28 word = string.replace(word,letter,'_')
29 return word
30
32 file_name = media.split(os.sep)[-1]
33 file_title = file_name.split('.')[:-1]
34 file_title = '.'.join(file_title)
35 file_ext = file_name.split('.')[-1]
36 return file_name, file_title, file_ext
37