本文整理汇总了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:]: