本文整理匯總了Python中UtilFunc.parseNameFromFile方法的典型用法代碼示例。如果您正苦於以下問題:Python UtilFunc.parseNameFromFile方法的具體用法?Python UtilFunc.parseNameFromFile怎麽用?Python UtilFunc.parseNameFromFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UtilFunc
的用法示例。
在下文中一共展示了UtilFunc.parseNameFromFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_parseNameFromFile_03
# 需要導入模塊: import UtilFunc [as 別名]
# 或者: from UtilFunc import parseNameFromFile [as 別名]
def test_parseNameFromFile_03(self):
self.assertEqual( UtilFunc.parseNameFromFile('parentPath/Word_Input_LastFirst.py') , 'LastFirst' )
示例2: enumerate
# 需要導入模塊: import UtilFunc [as 別名]
# 或者: from UtilFunc import parseNameFromFile [as 別名]
### If there's a file that was corrected and placed in midstream input, it will be processed also
### I believe single processing when possible is best for catching issues
### The outer most loop takes care of files trapped midstream
# rawListing = os.listdir(os.path.join(pathRaw, 'Input'))
### I am relating main module functions and the directories they work in by Alphabet Indecies
for moduleIndex1,mf1 in enumerate(moduleFunctions):
inputPath = os.path.join(mf1['ModulePath'],'Input')
fileListing = [os.path.join(inputPath,f) for f in os.listdir(inputPath)]
# print 'mf1 {}'.format(fileListing)
for fileName in fileListing:
# print 'name\t{}]'.format(fileListing)
#sometimes there are hidden files that break the script
if fileName.split('/')[-1][0] == '.':
continue
name = UtilFunc.parseNameFromFile(fileName)
number = UtilFunc.parseNumberFromFile(fileName)
# print '### fileName: {0}'.format(fileName)
# print '### name: {}, number: {}'.format(name, number)
#TODO: decide if this should be done as a prep step
if number == '':
number = str(getNumberFromNameInFile(name, yearbookReferenceFilePath))
# print '### Numer: {0}'.format(number)
fileNameWithNumber = UtilFunc.appendNumberToFileName(fileName,number)
shutil.copy(fileName,fileNameWithNumber)
os.remove(fileName)
fileName = fileNameWithNumber
# print 'Parsing: name = {0}\t number = {1}'.format(name,number)
outputFilePathPrevious = ''
for mf2 in moduleFunctions[moduleIndex1:]: