티스토리 뷰

   
   
   
   
   
   
    def TreatSubTag(self, elemIn, paramIn):
        tagProperty = paramIn.get('TagProperty')
        tagType = paramIn.get('TagType')
        tagValue = paramIn.get('TagValue')
        tagProperty = paramIn.get('TagProperty')
        valueID = paramIn.get('ValueID')
        attrib = paramIn.get('Attribute')
        subTags = paramIn.get('SubTag_s')

        rst1DF = DataFrame()

        if not tagProperty:
            print("[?] None of Tag Property")
            return
        if tagProperty == "Bundles":
            elems1 = self.GetElements(elemIn, tagType, tagValue)
            if not elems1:
                return
            for elem11 in elems1:
                if str(type(subTags))=="<class 'list'>":
                    for subTag in subTags:
                        res1 = self.TreatSubTag(elem11, subTag)
                        rst1DF = rst1DF.append(res1, ignore_index=True)
                elif str(type(subTags))=="<class 'dict'>":
                    res1 = self.TreatSubTag(elem11, subTags)
                    rst1DF = rst1DF.append(res1, ignore_index=True)
                else:
                    print("[?] Wrong Type of SubTags")
        elif tagProperty=="Bundle":
            elem1 = self.GetElement(elemIn, tagType, tagValue)
            if not elem1:
                return
            if str(type(subTags))=="<class 'list'>":
                for subTag in subTags:
                    res1 = self.TreatSubTag(elem1, subTag)
                    rst1DF = rst1DF.append(res1, ignore_index=True)
            elif str(type(subTags))=="<class 'dict'>":
                res1 = self.TreatSubTag(elem1, subTags)
                rst1DF = rst1DF.append(res1, ignore_index=True)
            else:
                print("[?] Wrong Type of SubTags")
        elif tagProperty == "Items":
            elems1 = self.GetElements(elemIn, tagType, tagValue)
            if not elems1:
                return
            for elem11 in elems1:
                if str(type(subTags))=="<class 'list'>":
                    for subTag in subTags:
                        res1 = self.TreatSubTag(elem11, subTag)
                        if not res1.empty: rst1DF = rst1DF.append(res1, ignore_index=True)
                elif str(type(subTags))=="<class 'dict'>":
                    res1 = self.GetItemValue(elem11, subTags)
                    if not res1.empty: rst1DF = rst1DF.append(res1, ignore_index=True)
                else:
                    print("[?] Wrong Type of SubTags")
            print(rst1DF)
        elif tagProperty=="aItem":
            if str(type(subTags))=="<class 'list'>":
                for subTag in subTags:
                    res1 = self.TreatSubTag(elem11, subTag) # subTag <== aItem
                    if not res1.empty: rst1DF = rst1DF.append(res1, ignore_index=True)
            elif str(type(subTags))=="<class 'dict'>":
                res1DF = self.GetItemValue(elem11, subTags) # subTag <== ItemValue
                if not res1.empty: rst1DF = rst1DF.append(res1, ignore_index=True)
            else:
                print("[?] Wrong Type of SubTags")

        return rst1DF

 

반응형

'SWDesk' 카테고리의 다른 글

[Python] Testing ... DataFrame  (0) 2022.05.31
[Python] PickNewItems - TreatPage()  (0) 2022.05.29
[Python] PickNewItems - GetItemValue()  (0) 2022.05.26
[Python] Data Addition after Initialization  (0) 2022.05.23
[Python] Stock Trade  (0) 2022.04.12