本文整理汇总了Python中UtilFunc.checkInputArgs方法的典型用法代码示例。如果您正苦于以下问题:Python UtilFunc.checkInputArgs方法的具体用法?Python UtilFunc.checkInputArgs怎么用?Python UtilFunc.checkInputArgs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UtilFunc
的用法示例。
在下文中一共展示了UtilFunc.checkInputArgs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_checkInputArgs_01
# 需要导入模块: import UtilFunc [as 别名]
# 或者: from UtilFunc import checkInputArgs [as 别名]
def test_checkInputArgs_01(self):
self.assertIsNone(UtilFunc.checkInputArgs(len(sys.argv)-1,['Failed if showing']))
示例2:
# 需要导入模块: import UtilFunc [as 别名]
# 或者: from UtilFunc import checkInputArgs [as 别名]
lWork = l.replace('\r',',').replace('\n',',').split(',')
for lw in lWork:
lw = lw.strip()
if lw != '':
names.append(lw)
for n in names:
fOut.write('{}\n'.format(n))
shutil.copy(inputFilePath,inputCompleteFilePath)
os.remove(inputFilePath)
return
########################
##### MAIN #####
########################
if __name__ == '__main__':
usageDescription = ["inputFilePath: A full path to a .txt file that contains a list of full names separated by '\\n' or ','",
'inputCompleteFilePath: ',
'errorFilePath: ',
'yearbookReferenceFilePath: A full path to a .csv file containing all expected classmates names along with their alphabetical index, among other details. See full documentation for extensive details',
'outputFilePath: A full path to a .csv file']
UtilFunc.checkInputArgs(5,usageDescription)
inputFilePath = sys.argv[1]
inputCompleteFilePath = sys.argv[2]
errorFilePath = sys.argv[3]
yearbookReferenceFilePath = sys.argv[4]
outputFilePath = sys.argv[5]
fixRawList(inputFilePath,inputCompleteFilePath, errorFilePath, yearbookReferenceFilePath,outputFilePath)
示例3: writeToFile
# 需要导入模块: import UtilFunc [as 别名]
# 或者: from UtilFunc import checkInputArgs [as 别名]
'YearbookLast':ln,
'YearbookFirst':fn}
groupDataWithNames.append(entry)
return groupDataWithNames
def writeToFile(data, fileOutput):
with open(fileOutput,'w') as fOut:
fOut.write('GroupNumber,GroupScore,AlphaIndex,YearbookLast,YearbookFirst\n')
for entry in data:
fOut.write('{},{},{},{},{}\n'.format( entry['GroupNumber'],
entry['GroupScore'],
entry['AlphaIndex'],
entry['YearbookLast'],
entry['YearbookFirst']))
########################
##### MAIN #####
########################
usageDescription = ['fileInput: A full path to a .csv file containing nXn pair scores',
'yearbookNamesFile: A full path to a .csv file containing all expected classmates names along with their alphabetical index, among other details. See full documentation for extensive details',
'fileOutput: A full path to a .csv file']
UtilFunc.checkInputArgs(3)
fileInput = sys.argv[1]
yearbookNamesFile = sys.argv[2]
fileOutput = sys.argv[3]
groupData = buildGroups(fileInput)
groupDataWithNames = attachNames(groupData,yearbookNamesFile)
writeToFile(groupDataWithNames, fileOutput)