SlideShare a Scribd company logo
1 of 9
Download to read offline
Pyhon
dict()
Алексей Бованенко
a.bovanenko@gmail.com
python dict()
● d = dict()
● d = {'key1':'value1', 'key2':'value2'}
● d1 = dict(d)
● d2 = dict()
for i in range(5):
d2[i] = ‘value’+str(i)
python dict clear()
● clear() -> None
● d = {‘key1’: ‘value1’, ‘key2’: ‘value2’}
● d.clear()
○ {}
python dict copy()
● d = {‘key1’: ‘value1’, ‘key2’: ‘value2’}
● d_copy = d.copy()
● d_copy
○ {‘key1’: ‘value1’, ‘key2’: ‘value2’}
python dict get()
● get(k[,v]) -> d[k] if k in d, else v. v defaults to None
● d = {'key1':'value1', 'key2':'value2'}
● d.get('key3')
○ ‘’
● d.get('key2')
○ 'value2'
python dict has_key()
● has_key(k) -> True if D has a key k, else False
● d = {'key1':'value1', 'key2':'value2'}
● d.has_key(‘key2’)
○ True
● d.has_key(‘key3’)
○ False
python dict items()
● items() -> list of D's (key, value) pairs
● d.items()
○ [('key2', 'value2'), ('key1', 'value1')]
● for p in d.items(): # for (k,v) in d.items():
print p[0], p[1] # print k, v
○ key2 value2
○ key1 value1
python dict iteritems()
● iteritems() -> an iterator over the (key, val) items of d
● for (k,v) in d.iteritems():
print k,v
Спасибо за внимание
Вопросы?

More Related Content

What's hot

CBSE Python Dictionary Assignment
CBSE Python Dictionary AssignmentCBSE Python Dictionary Assignment
CBSE Python Dictionary AssignmentAmit Sethi
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++Ankit Kumar
 
Geometric and material nonlinearity analysis of 2 d truss with force control ...
Geometric and material nonlinearity analysis of 2 d truss with force control ...Geometric and material nonlinearity analysis of 2 d truss with force control ...
Geometric and material nonlinearity analysis of 2 d truss with force control ...Salar Delavar Qashqai
 
CBSE Python String Assignment
CBSE Python String AssignmentCBSE Python String Assignment
CBSE Python String AssignmentAmit Sethi
 
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : NotesCUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : NotesSubhajit Sahu
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsKandarp Tiwari
 
Frsa
FrsaFrsa
Frsa_111
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programsAmit Kapoor
 
SE Computer, Programming Laboratory(210251) University of Pune
SE Computer, Programming Laboratory(210251) University of PuneSE Computer, Programming Laboratory(210251) University of Pune
SE Computer, Programming Laboratory(210251) University of PuneBhavesh Shah
 
Matlab assignment
Matlab assignmentMatlab assignment
Matlab assignmentRutvik
 
computer graphics practicals
computer graphics practicalscomputer graphics practicals
computer graphics practicalsManoj Chauhan
 

What's hot (15)

CBSE Python Dictionary Assignment
CBSE Python Dictionary AssignmentCBSE Python Dictionary Assignment
CBSE Python Dictionary Assignment
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++
 
Geometric and material nonlinearity analysis of 2 d truss with force control ...
Geometric and material nonlinearity analysis of 2 d truss with force control ...Geometric and material nonlinearity analysis of 2 d truss with force control ...
Geometric and material nonlinearity analysis of 2 d truss with force control ...
 
CBSE Python String Assignment
CBSE Python String AssignmentCBSE Python String Assignment
CBSE Python String Assignment
 
Grid help, Processing
Grid help, ProcessingGrid help, Processing
Grid help, Processing
 
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : NotesCUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
CUDA First Programs: Computer Architecture CSE448 : UAA Alaska : Notes
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C Programs
 
Frsa
FrsaFrsa
Frsa
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programs
 
Computer graphics
Computer graphics   Computer graphics
Computer graphics
 
SE Computer, Programming Laboratory(210251) University of Pune
SE Computer, Programming Laboratory(210251) University of PuneSE Computer, Programming Laboratory(210251) University of Pune
SE Computer, Programming Laboratory(210251) University of Pune
 
Matlab assignment
Matlab assignmentMatlab assignment
Matlab assignment
 
computer graphics practicals
computer graphics practicalscomputer graphics practicals
computer graphics practicals
 
Computer Practical XII
Computer Practical XIIComputer Practical XII
Computer Practical XII
 
C#, What Is Next?
C#, What Is Next?C#, What Is Next?
C#, What Is Next?
 

Viewers also liked

HRM 595 Innovative Educator/hrm595.com
HRM 595 Innovative Educator/hrm595.comHRM 595 Innovative Educator/hrm595.com
HRM 595 Innovative Educator/hrm595.comGraceSamuel9
 
Catalogue2009
Catalogue2009Catalogue2009
Catalogue2009cbsplv
 
Emily Resume 2016
Emily Resume 2016 Emily Resume 2016
Emily Resume 2016 Emily Evans
 
Python assignment help from professional programmers
Python assignment help from professional programmersPython assignment help from professional programmers
Python assignment help from professional programmersAnderson Silva
 
MobilePlots.com - Policy Control today and tomorrow - SDN and 5G
MobilePlots.com - Policy Control today and tomorrow - SDN and 5GMobilePlots.com - Policy Control today and tomorrow - SDN and 5G
MobilePlots.com - Policy Control today and tomorrow - SDN and 5GAlberto Diez
 
Coaching explained, illustrated updated 2013 version, coach
Coaching explained, illustrated updated 2013 version, coachCoaching explained, illustrated updated 2013 version, coach
Coaching explained, illustrated updated 2013 version, coachAlexander Crépin
 
Workshop Activating Creativity THE HR challenge for the coming years by Ale...
Workshop Activating Creativity THE HR challenge for the coming years  by  Ale...Workshop Activating Creativity THE HR challenge for the coming years  by  Ale...
Workshop Activating Creativity THE HR challenge for the coming years by Ale...Alexander Crépin
 
Corporate finance assignment help
Corporate finance assignment helpCorporate finance assignment help
Corporate finance assignment helpAnderson Silva
 
Certificado de Calidad: "Reading Together"
Certificado de Calidad: "Reading Together"Certificado de Calidad: "Reading Together"
Certificado de Calidad: "Reading Together"Javier Ramos Sancha
 
Ferdinand Saussure- su vida, obras y aportes a ña linguistica
Ferdinand Saussure- su vida, obras y aportes a ña linguisticaFerdinand Saussure- su vida, obras y aportes a ña linguistica
Ferdinand Saussure- su vida, obras y aportes a ña linguisticachikyariguerra
 
Deep Dive into Keystone Tokens and Lessons Learned
Deep Dive into Keystone Tokens and Lessons LearnedDeep Dive into Keystone Tokens and Lessons Learned
Deep Dive into Keystone Tokens and Lessons LearnedPriti Desai
 

Viewers also liked (13)

HRM 595 Innovative Educator/hrm595.com
HRM 595 Innovative Educator/hrm595.comHRM 595 Innovative Educator/hrm595.com
HRM 595 Innovative Educator/hrm595.com
 
Catalogue2009
Catalogue2009Catalogue2009
Catalogue2009
 
Tp1 informatica
Tp1 informaticaTp1 informatica
Tp1 informatica
 
Emily Resume 2016
Emily Resume 2016 Emily Resume 2016
Emily Resume 2016
 
Python assignment help from professional programmers
Python assignment help from professional programmersPython assignment help from professional programmers
Python assignment help from professional programmers
 
MobilePlots.com - Policy Control today and tomorrow - SDN and 5G
MobilePlots.com - Policy Control today and tomorrow - SDN and 5GMobilePlots.com - Policy Control today and tomorrow - SDN and 5G
MobilePlots.com - Policy Control today and tomorrow - SDN and 5G
 
Coaching explained, illustrated updated 2013 version, coach
Coaching explained, illustrated updated 2013 version, coachCoaching explained, illustrated updated 2013 version, coach
Coaching explained, illustrated updated 2013 version, coach
 
Workshop Activating Creativity THE HR challenge for the coming years by Ale...
Workshop Activating Creativity THE HR challenge for the coming years  by  Ale...Workshop Activating Creativity THE HR challenge for the coming years  by  Ale...
Workshop Activating Creativity THE HR challenge for the coming years by Ale...
 
Corporate finance assignment help
Corporate finance assignment helpCorporate finance assignment help
Corporate finance assignment help
 
Certificado de Calidad: "Reading Together"
Certificado de Calidad: "Reading Together"Certificado de Calidad: "Reading Together"
Certificado de Calidad: "Reading Together"
 
Python Programming Essentials - M27 - Logging module
Python Programming Essentials - M27 - Logging modulePython Programming Essentials - M27 - Logging module
Python Programming Essentials - M27 - Logging module
 
Ferdinand Saussure- su vida, obras y aportes a ña linguistica
Ferdinand Saussure- su vida, obras y aportes a ña linguisticaFerdinand Saussure- su vida, obras y aportes a ña linguistica
Ferdinand Saussure- su vida, obras y aportes a ña linguistica
 
Deep Dive into Keystone Tokens and Lessons Learned
Deep Dive into Keystone Tokens and Lessons LearnedDeep Dive into Keystone Tokens and Lessons Learned
Deep Dive into Keystone Tokens and Lessons Learned
 

Similar to python dict

Goal Programming
Goal ProgrammingGoal Programming
Goal ProgrammingEvren E
 
Tech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применениеTech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применениеTech Talks @NSU
 
goalprogramming-150911073618-lva1-app6891 (1).pdf
goalprogramming-150911073618-lva1-app6891 (1).pdfgoalprogramming-150911073618-lva1-app6891 (1).pdf
goalprogramming-150911073618-lva1-app6891 (1).pdfAmritDas30
 
Basic python programs
Basic python programsBasic python programs
Basic python programsRaginiJain21
 
Crypto cs36 39
Crypto cs36 39Crypto cs36 39
Crypto cs36 39sravanbabu
 

Similar to python dict (10)

Goal Programming
Goal ProgrammingGoal Programming
Goal Programming
 
cs8project
cs8projectcs8project
cs8project
 
Ch10
Ch10Ch10
Ch10
 
Tech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применениеTech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применение
 
goalprogramming-150911073618-lva1-app6891 (1).pdf
goalprogramming-150911073618-lva1-app6891 (1).pdfgoalprogramming-150911073618-lva1-app6891 (1).pdf
goalprogramming-150911073618-lva1-app6891 (1).pdf
 
Goal Programming
Goal ProgrammingGoal Programming
Goal Programming
 
Basic python programs
Basic python programsBasic python programs
Basic python programs
 
seminar_presentation_krypto
seminar_presentation_kryptoseminar_presentation_krypto
seminar_presentation_krypto
 
Digital signature
Digital signatureDigital signature
Digital signature
 
Crypto cs36 39
Crypto cs36 39Crypto cs36 39
Crypto cs36 39
 

More from Alexey Bovanenko (20)

Python sqlite3
Python sqlite3Python sqlite3
Python sqlite3
 
Python. re
Python. rePython. re
Python. re
 
Python. Строки
Python. СтрокиPython. Строки
Python. Строки
 
Python. Введение
Python. ВведениеPython. Введение
Python. Введение
 
Nio java
Nio javaNio java
Nio java
 
Конвертация строковых данных в числовые
Конвертация строковых данных в числовыеКонвертация строковых данных в числовые
Конвертация строковых данных в числовые
 
Assert c
Assert cAssert c
Assert c
 
Обработка символов в языке C
Обработка символов в языке CОбработка символов в языке C
Обработка символов в языке C
 
System c
System cSystem c
System c
 
Javascript functions
Javascript functionsJavascript functions
Javascript functions
 
Javascript String object
Javascript String objectJavascript String object
Javascript String object
 
File. Java
File. JavaFile. Java
File. Java
 
ZIP, GZIP Streams in java
ZIP, GZIP Streams in javaZIP, GZIP Streams in java
ZIP, GZIP Streams in java
 
Конструктор копирования
Конструктор копированияКонструктор копирования
Конструктор копирования
 
Tempale Intro
Tempale IntroTempale Intro
Tempale Intro
 
transaction. php
transaction. phptransaction. php
transaction. php
 
cookie. support by php
cookie. support by phpcookie. support by php
cookie. support by php
 
php sessions
php sessionsphp sessions
php sessions
 
Java IO. Streams
Java IO. StreamsJava IO. Streams
Java IO. Streams
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 

Recently uploaded

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 

Recently uploaded (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 

python dict