Ana sayfa Genel Python – Sözlükler (Dictionary)

Python – Sözlükler (Dictionary)

1613
62
PAYLAŞ

Sözlükler

Sözlükler veya İngilizce ismiyle dictionaryler aynı gerçek hayattaki sözlükler gibi davranan bir veritipidir. Bu veritipi, şimdiye kadar gördüğümüz tüm veritiplerinden yapısı gereği farklıdır. Sözlüğün içindeki her bir eleman indeks ile değil, anahtar (key), değer (value) olarak tutulur. Bu anlamda gerçek hayattaki sözlüklere oldukça benzerler. Örneğin, elimize bir ingilizce-Türkçe sözlük alıp freedom kelimesini(key ya da anahtar) aradığımız zaman karşılık değer özgürlük (değer ya da value) olarak karşımıza çıkar. Sözlükleri de bu şekilde düşünebiliriz.

Şimdi isterseniz bir sözlük oluşturarak konumuza başlayalım.

Sözlük Oluşturmak


Sözlük Değerlerine Erişmek ve Sözlüğe Değer Eklemek

Sözlük veritipinin gerçek hayattaki sözlüklere çok benzediğini söylemiştik. Öyleyse, bir değeri (value) elde etmek için, indeksleri değil anahtarları (key) kullanacağız.

Bir sözlüğe dinamik olarak da eleman ekleyebiliriz.

Dikkat ederseniz yeni eklediğimiz anahtar ve değer sözlüğün sonuna eklenmedi. Burada sözlüklerin bir özelliğini daha görüyoruz. Sözlükler diğer veritiplerinden farklı olarak sıralı olmayan bir veritipidir.

İç içe Sözlükler

Tıpkı listeler gibi, iç içe sözlükler de oluşturulabilir.

 

Temel Sözlük Metodları

Bu konuda sözlüklerin yapısını biraz anladıysak iyi yol katetmişiz demektir. Zaten sözlükleri ilerde daha derinlemesine göreceğimiz için konumuzu burada bitirebiliriz.

62 YORUMLAR

  1. Empresa con más de 30 de años de experiencia al servicio de nuestros clientes, tanto instaladores como particulares. Estamos especializados en la venta de material de fontanería, calefacción, saneamiento, energía solar, tratamientos de aguas, aire acondicionado, etc. Contamos con profesionales altamente cualificados y acreditados que ofrecen la mejor calidad en nuestros servicios.

  2. Hi would you mind stating which blog platform you’re working with? I’m planning to start my own blog in the near future but I’m having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I’m looking for something unique. P.S My apologies for getting off-topic but I had to ask!

  3. I’m really enjoying the theme/design of your site. Do you ever run into any browser compatibility issues? A few of my blog audience have complained about my site not operating correctly in Explorer but looks great in Chrome. Do you have any ideas to help fix this problem?

  4. Creo que te hubiera salido mejor llevarlo a una de esas tiendas de Paquistaní y en estos momentos tendrías tú móvil en la mano, quien sabe a lo mejor te hubiera salido más barato que en bendito seguro ese, por lo menos no hubieras pasado la rabia que estás pasando por el mal servicio de esta empresa. Respondele que por ley todas las substituciones y reparaciones con un coste elevado le pertocan a ella, ya sean de la nevera del aire acondicionado incluso de las persianas.

  5. En cuanto a la agresión del 28 de febrero, indicaron que tienen plenamente identificados a los funcionarios que actuaron en su contra para reventar” la manifestación y, cuando no lo lograron, enviaron al grupo de choque que agredió y lesionó a más de diez personas que participaban en la protesta. Así lo aseguró el director regional noreste de la CFE, Víctor Fernández, quien a su vez recordó que estos contratos obligan también a tener un 30 por ciento de contenido nacional, siempre y cuando sean aquellos que presenten las propuestas que logren bajar los precios del servicio eléctrico.

  6. Simply wish to say your article is as surprising.
    The clarity in your post is simply great and i could assume you’re an expert
    on this subject. Well with your permission allow me to grab your
    feed to keep updated with forthcoming post. Thanks a million and please keep up the gratifying work.

  7. Torno : el torno es la máquina herramienta de mecanizado más difundida, éstas son en la industria las de uso más general, la pieza se fija en el plato del torno, que realiza el movimiento de corte girando sobre su eje, la cuchilla realiza el movimiento de avance eliminando el material en los sitios precisos.

  8. Seguramente ahora conozcas más secretos de los talleres de mecanizados. Si bien la experiencia supone un gran beneficio para los mecanizados CNC, en algunos casos puede no ser tan necesario como con las máquinas convencionales. Cortec cuenta con maquinaria e instalaciones de última generación para poder realizar trabajos de gran envergadura.

  9. Hey! This post couldn’t be written any better!
    Reading this post reminds me of my old room mate! He always kept chatting about this.
    I will forward this article to him. Pretty sure he will have a good read.
    Thanks for sharing!

  10. Fantastic goods from you, man. I have understand your stuff previous to and you are just extremely wonderful. I really like what you have acquired here, really like what you are saying and the way in which you say it. You make it enjoyable and you still care for to keep it wise. I can not wait to read far more from you. This is really a terrific website.

  11. Amazing! This blog looks exactly like my old one! It’s on a totally different topic but it has pretty much the same page layout and design. Superb choice of colors!

  12. It is the best time to make some plans for the future and it’s time to be happy. I have read this post and if I could I want to suggest you some interesting things or suggestions. Maybe you could write next articles referring to this article. I wish to read even more things about it!

  13. Hello There. I found your blog using msn. That is a really smartly written article. I will be sure to bookmark it and return to learn extra of your useful info. Thanks for the post. I will certainly comeback.

  14. It is appropriate time to make a few plans for the future and it is time to be happy. I’ve learn this post and if I could I want to counsel you few attention-grabbing issues or tips. Perhaps you can write next articles regarding this article. I desire to read even more issues about it!

  15. It’s really a nice and helpful piece of info. I’m satisfied that you simply shared
    this helpful info with us. Please keep us up to date like
    this. Thank you for sharing.

  16. Thanks for the sensible critique. Me & my neighbor were just preparing to do a little research about this. We got a grab a book from our local library but I think I learned more clear from this post. I’m very glad to see such magnificent info being shared freely out there.

  17. Hi my family member! I wish to say that this article is amazing, nice written and come with approximately all important infos. I would like to peer extra posts like this.

  18. Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your webpage?
    My website is in the exact same area of interest as yours and my visitors would truly benefit from a
    lot of the information you present here. Please let me know if this ok with you.
    Thanks a lot!

  19. Thanks for some other magnificent article. The place else could anybody get that kind of information in such an ideal means of writing? I’ve a presentation next week, and I am on the look for such info.

  20. I’m curious to find out what blog platform you happen to be working with? I’m experiencing some minor security problems with my latest site and I would like to find something more risk-free. Do you have any recommendations?

  21. You made some decent factors there. I regarded on the internet for the problem and found most individuals will go together with along with your website.

  22. What¦s Happening i am new to this, I stumbled upon this I’ve discovered It absolutely helpful and it has aided me out loads. I’m hoping to contribute & help other customers like its helped me. Good job.

  23. Incredible! This blog looks just like my old one! It’s on a completely different subject but it has pretty much the same page layout and design. Superb choice of colors!

  24. Having read this I thought it was very informative. I appreciate you taking the time and effort to put this article together. I once again find myself spending way to much time both reading and commenting. But so what, it was still worth it!

  25. hello!,I like your writing so much! share we communicate more about your post on AOL? I need an expert on this area to solve my problem. Maybe that’s you! Looking forward to see you.

  26. Thanx for the effort, keep up the good work Great work, I am going to start a small Blog Engine course work using your site I hope you enjoy blogging with the popular BlogEngine.net.Thethoughts you express are really awesome. Hope you will right some more posts.

  27. I discovered your blog site on google and check a few of your early posts. Continue to keep up the very good operate. I just additional up your RSS feed to my MSN News Reader. Seeking forward to reading more from you later on!…

  28. I was curious if you ever considered changing the structure of your site? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or 2 pictures. Maybe you could space it out better?

  29. Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a bit, but instead of that, this is great blog. An excellent read. I will definitely be back.

  30. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You definitely know what youre talking about, why waste your intelligence on just posting videos to your blog when you could be giving us something enlightening to read?

BİR CEVAP BIRAK

Lütfen yorumunuzu giriniz
Buraya isminizi giriniz