Найти - Пользователи
Полная версия: в чем разница? di.setdefault('test',0) vs di['test']=0 это словари
Начало » Python для новичков » в чем разница? di.setdefault('test',0) vs di['test']=0 это словари
1
beliy_shum
di.setdefault('test',0) vs di=0
j2a
>>> d = dict()
>>> d['key'] = 'value'
>>> d.setdefault('key', 'another value')
<<< 'value'
>>> d['key']
<<< 'value'
>>> d.setdefault('another key', 'another value')
<<< 'another value'
пояснения нужны?
beliy_shum
спасибо)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB