当前位置: 首页>>代码示例>>Python>>正文


Python UtilFunc.parseNumberFromFile方法代码示例

本文整理汇总了Python中UtilFunc.parseNumberFromFile方法的典型用法代码示例。如果您正苦于以下问题:Python UtilFunc.parseNumberFromFile方法的具体用法?Python UtilFunc.parseNumberFromFile怎么用?Python UtilFunc.parseNumberFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UtilFunc的用法示例。


在下文中一共展示了UtilFunc.parseNumberFromFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_parseNumberFromFile_03

# 需要导入模块: import UtilFunc [as 别名]
# 或者: from UtilFunc import parseNumberFromFile [as 别名]
	def test_parseNumberFromFile_03(self):
		self.assertEqual( UtilFunc.parseNumberFromFile('parentPath/Word_Input_LastFirst_-3.py') , '' )
开发者ID:cdslug,项目名称:ClassmateMemory,代码行数:4,代码来源:TestScript.py

示例2: enumerate

# 需要导入模块: import UtilFunc [as 别名]
# 或者: from UtilFunc import parseNumberFromFile [as 别名]
### 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:]:
开发者ID:cdslug,项目名称:ClassmateMemory,代码行数:32,代码来源:ClassmateBatch.py


注:本文中的UtilFunc.parseNumberFromFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。