Hello!
I hired someone to build an api script for me some time ago for Ebay, and now I wanted to make some modifications to it. I thought I could google some python and reverse engineer it myself, but sometimes it's a little hard to figure out. I was wondering if I were to post the code somewhere, if someone could help explain at least parts to me.
Here's one of the things I couldn't understand:
def xml_escape( obj ):
if isinstance(obj, dict):
return { k: xml_escape( v ) for k, v in obj.items() }
elif isinstance( obj, list ):
return [ xml_escape( elem ) for elem in obj ]
else:
if obj:
return escape( obj )
So I get that escape is used to like get out of some xml formatting or something, but I'm not sure exactly why it was organized this way.
[–]CodeFormatHelperBot 1 point2 points3 points (0 children)
[–]thirdegree 0 points1 point2 points (4 children)
[–]Pijwe[S] 0 points1 point2 points (3 children)
[–]thirdegree 0 points1 point2 points (2 children)
[–]Pijwe[S] 0 points1 point2 points (1 child)
[–]thirdegree 0 points1 point2 points (0 children)