本文整理匯總了Python中StringUtils.StringUtils.getStringInBrackets方法的典型用法代碼示例。如果您正苦於以下問題:Python StringUtils.getStringInBrackets方法的具體用法?Python StringUtils.getStringInBrackets怎麽用?Python StringUtils.getStringInBrackets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類StringUtils.StringUtils
的用法示例。
在下文中一共展示了StringUtils.getStringInBrackets方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: readDependentPackageData
# 需要導入模塊: from StringUtils import StringUtils [as 別名]
# 或者: from StringUtils.StringUtils import getStringInBrackets [as 別名]
def readDependentPackageData(self,line):
strUtils = StringUtils()
listPackages=line.split(",")
listdependentpkgs=[]
for line in listPackages:
line=strUtils.getStringInBrackets(line)
listContents=line.split()
totalContents = len(listContents)
i=0
while i < totalContents:
dpkg = dependentPackageData()
compare=None
if listContents[i].startswith("/"):
i=i+1
continue
if i+2 < len(listContents):
if listContents[i+1] == ">=":
compare="gte"
elif listContents[i+1] == "<=":
compare="lte"
elif listContents[i+1] == "==":
compare="eq"
elif listContents[i+1] == "<":
compare="lt"
elif listContents[i+1] == ">":
compare="gt"
elif listContents[i+1] == "=":
compare="eq"
if compare is not None:
dpkg.package=listContents[i]
dpkg.compare=compare
dpkg.version=listContents[i+2]
i=i+3
else:
dpkg.package=listContents[i]
i=i+1
listdependentpkgs.append(dpkg)
return listdependentpkgs