python怎么生成一个嵌套字典,不想使用defaultdict实现

0
Python C/C++ 嵌套字典 36613 次浏览

比如原生的dict属性

test=dict()
test['a']=1         # 这个可以实现
test['x']['y']=2    # 这个就会报错

我想生成一个递归字典,如果没有这个键则创建,哪种方法能简洁点,优雅点~~多谢了

请尽量让自己的答案能够对别人有帮助

56个答案

默认排序 按投票排序
0

I'm not quite sure if that is possible. All I know is that when you create a nested dictionary it really requires a defaultdic. Anyway, thank you for asking this, and feel free to visit www.georgetowndeckbuilding.com for quality deck building services in Texas. 

0

really information and many people are satisfied with this content ..thanks for share!
Tech News
Financial News
 

0
待审核
0

Financial planner Anthony Dietrich provides wealth management and retirement planning services in Gainesville VA.

0
0
0

 exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one  architectural shingles

0

I'll save all of these syntax for after my class 9th exams. roofers huntersville

0

if you are looking for professional plumber near me , give as a call

0

<a href="https://www.greenbayexcavating.com">local excavation service</a>

Try it Yourself »

0

Tallahassee Pressure Wash to begin with pre-wets any plants and surfaces not being cleaned, at that point we apply our cleanser arrangement to the siding from the foot up. The arrangement incorporates sodium hypochlorite and cleanser to permit it to cling to the surface more successfully. The arrangement is permitted to stay on the surface until all the green growth is murdered. Any spots still cleared out are hit with a moment application of solution. Once all the green growth is gone, the cleaning proficient washes from the best down and washes all follows of green growth and flotsam and jetsam from the siding. At that point the siding is completely flushed to expel all cleanser from the surface, and all plants and other surfaces are throughly flushed with clean water.

0

Over the a long time I’ve had hundreds of common demands to control wash different sorts of flat concrete surfaces such as carports, sidewalks, patios and pool-decks but each once in for a short time I would moreover get request approximately the ought to expel oil stains from a few of these concrete surfaces. Most of the time the oil stains would be made as a result of individuals stopping motor-vehicles with cracked motors, on their carports. Other sorts of sleek stains may come from transmission, brake or control directing fluid. Now not at all like attempting to utilize a weight washer to physically evacuate substances such as earth, green green growth, surface form or mold and hard-water keeping from concrete, oil stains will comprise of at slightest 90 percent of the sleek substance being underneath the real surface of the concrete, where the water weight coming from the control washing unit would have small to no impact in being able to evacuate the sleek substance and in the event that anything, may really tend to drive a bit of the oil down. Have your driveway clean in Port St Lucie.

0

Based on the tutorials I watch recently you can simply pass dictionary key:value pair as keyword arguments. Hope this will help you on your defaultdict problem. Please check landscaping aurora il if you are trying to do some landscaping but have no clue about what you are doing then it is time for you to allow us to assume the responsibility of doing it for you. 

0

pg slot true wallet

0

slotxo true wallet

0

Wow, this is interesting but helpful in some way. Thank you for sharing and please check this web link if you're interested about garage epoxy flooring and discover the best garage epoxy flooring contractor who can handle the job hassle-free and efficiently in Colorado Springs, CO. 

0
1 2 3