python - How to deep copy a dictionary without .deepcopy -
this question has answer here:
is there way create deep copy of dictionary without copy module? need copy dictionary of dictionaries n times, working in environment pared down jython libraries not include copy. cannot add modules system.
i convert dictionaries lists , use [:] copy, wondering if possible dictionaries.
so dictionary-inside-dictionary goes 1 level deep? if so, try:
copy = {} k, v in original.items(): copy[k] = dict(v)
Comments
Post a Comment