Beruflich Dokumente
Kultur Dokumente
if len(SplitList) > 2:
#----------------------------------------------------------------------------# Split the partname in substrings FStr, MStr and LStr
#----------------------------------------------------------------------------FStr = SplitList[0]
LStr = SplitList[-1]
SplitList = SplitList[1:-1]
MStr = string.joinfields(SplitList,Delimiter)
#----------------------------------------------------------------------------# If the last string consists of 'A' followed by numbers
# then suppress the numbers
#----------------------------------------------------------------------------if LStr[0] == 'A':
PosStr = LStr[1:]
try:
PosNo = eval(PosStr)
LStr = 'A'
except:
PosNo = -1
#----------------------------------------------------------------------------# Join substrings FStr, MStr and LStr to compose the customized partname
#----------------------------------------------------------------------------CustPartName = FStr + Delimiter + MStr + Delimiter + LStr
return CustPartName
#
#----------------------------------------------------------------------------# Self test when run as top level script
#----------------------------------------------------------------------------#
if __name__ == "__main__":
print "_TBhook_CustPartName"
print getPartName("","121-BK40A-A","BK001","","","","","",35,0,1,0,"","","",""
,"BK400-2-1P",0,"121-BK40A-A35")
print getPartName("","141-BK40P-AB","BK001","","","","","",35,0,1,0,"","","","
","BK400-3-1S",0,"141-BK40P-AB35")
print getPartName("","121-BK40A-B","BK001","","","","","",35,0,1,0,"","","",""
,"BK400-4-1P",0,"121-BK40A-B35")