We have requirement to write simple xml in string format from listed dictionaries
iterating through list and iterating through each dictionarie and write xml format (i.e. dict key is xml key and dict value is dict value ex:- <First_name>James</First_name> ), if the value contains dictionary again we need to loop on that value and write innter xml format string, and again if the inner value is dictionary and again a loop to write xml string...

So we may not know how many inner dictionaries comes but we need to write nested loop how that possible in python?

Thanks a lot dude :) i am new to Python, concepts are same, syntax is little bit different only

Use recursion: write a function F(dictionary) to write a dictionary. In the function's body, iterate over the dictionary items, and if one of the item contains a new dictionary, call F(subdictionary) again to write this dict.

Thanks Gribouillis, I've question that can we call a function itself which is already in progress? I thought the same but didn't try.