Ana sayfa Genel Python – Modüller ve Örnek Modül Kullanımı

Python – Modüller ve Örnek Modül Kullanımı


Modül Mantığı

Bu konuda modüllerin ne demek olduğunu ve mantığını anlamaya çalışacağız.

Pythonda aslında her bir dosya bir modüldür ve her bir modül içinde fonksiyonlar, sınıflar ve objeler barındırır. Biz de bu modülleri programımıza dahil ederek içindeki fonksiyonlardan, sınıflardan ve objelerden faydalanabiliriz.

Gerçek hayattan benzetme yapacak olursak bir matematik ödevini yaparken kullandığımız formül kitabı aslında bir modül olarak düşünülebilir. Bu kitabı ödev yaparken kullanarak ödevimizi çok hızlı ve pratik bir şekilde bitirebiliriz.

Pythonda da modül kavramı oldukça önemli bir kavramdır. Bir Python modülünü programımıza dahil ederek bu modüller içinde yazılan fonksiyonlardan ve sınıflardan kullanabilir ve programlarımızı daha efektif bir şekilde yazabiliriz. Eğer modül diye bir kavram olmasaydı, programlarımızdaki herbir fonksiyonu ve sınıfı kendimiz yazmak zorunda kalacaktık.

Pythonda Python geliştiricileri tarafından yazılmış bir çok hazır modül bulunmaktadır. Ayrıca , programcıların internete ve Githuba yükledikleri bir çok modülü programlarımızda kullanabilir ve daha güzel programlar yazabiliriz.

Modül Kullanımı – math Modülü

Bu derste Pythonda modüller nasıl kullanılır öğrenmeye çalışacağız. Ayrıca bir modülü içeri aktarmanın değişik yöntemlerini göreceğiz.

İsterseniz hazır bir modül olan math modülünü kullanmaya başlayalım.

Yöntem1 – import modül_adı

Bir modülü içeri aktarmak yani programımıza dahil etmek için import modül_adı yazabiliriz. İsterseniz bunun için math modülünü içeri aktaralım.

Peki bu içeri aktarma yöntemiyle math modülünün herhangi bir fonksiyonunu nasıl kullanacağız ?

Örneğin ilk olarak math modülünün içindeki factorial fonksiyonu ne iş yapıyor bakalım.

Peki biz bir modülü kendi belirlediğimiz isimle nasıl kullanıyoruz ? Bunun için de şu şekilde bir şey yapacağız.

Yöntem2 – from modül_adı import *

Bir modülü programımıza dahil etmek için bu yöntemi de kullanabiliriz. İsterseniz math modülünü bu yöntem içeri aktaralım.

Peki böyle bir durumda math modülünün içindeki fonksiyonları nasıl kullanacağız. Bunun için modül ismini yazmamıza gerek kalmamaktadır.

Peki bir modül içindeki fonksiyonların belli bir kısmını almak için ne yapacağız ? Bunun için hangi fonksiyonları alacağımızı özellikle belirtmemiz gerekiyor.

Not : Öncelikle IDLE üzerinden veya Jupyter üzerinden çalışıyorsanız programları tekrardan başlatın.

Peki bu yöntemlerin birbirinden farkı ne ? 2.yöntemi kullandığımızda bildiğimiz gibi sadece fonksiyon isimlerini kullanıyoruz. Ancak eğer programa birden fazla modül dahil edersek veya dahil ettiğimiz modülün içindeki fonksiyon kendi tanımladığımız fonksiyon ismiyle aynıysa Python son gördüğü fonksiyonu çalıştıracaktır.

Not : Öncelikle IDLE üzerinden veya Jupyter üzerinden çalışıyorsanız programları tekrardan başlatın.



  1. What i don’t understood is actually how you’re not really much more well-liked than you may be now. You’re so intelligent. You recognize therefore significantly on the subject of this topic, made me for my part believe it from numerous varied angles. Its like men and women don’t seem to be interested unless it is something to do with Woman gaga! Your individual stuffs excellent. At all times deal with it up!

  2. I’d have to examine with you here. Which is not one thing I usually do! I take pleasure in reading a post that may make folks think. Additionally, thanks for permitting me to comment!

  3. The core of your writing whilst appearing reasonable at first, did not really sit perfectly with me personally after some time. Somewhere throughout the sentences you were able to make me a believer unfortunately just for a short while. I however have got a problem with your jumps in assumptions and you might do well to help fill in those gaps. In the event that you actually can accomplish that, I could certainly be impressed.

  4. I’m not sure exactly why but this weblog is loading extremely slow for me. Is anyone else having this issue or is it a issue on my end? I’ll check back later and see if the problem still exists.

  5. What’s Taking place i’m new to this, I stumbled upon this I’ve discovered It positively useful and it has aided me out loads. I hope to give a contribution & assist other customers like its aided me. Great job.

  6. of course like your website but you need to check the spelling on several of your posts. Several of them are rife with spelling problems and I in finding it very bothersome to tell the truth nevertheless I will definitely come again again.

  7. My partner and I absolutely love your blog and find a lot of your post’s to be exactly what I’m looking for. Would you offer guest writers to write content in your case? I wouldn’t mind producing a post or elaborating on some of the subjects you write in relation to here. Again, awesome site!

  8. Fantastic items from you, man. I have be aware your stuff previous to and you are simply too excellent. I actually like what you have got here, really like what you are stating and the way in which wherein you assert it. You make it entertaining and you still care for to keep it sensible. I can not wait to read far more from you. That is really a tremendous site.

  9. Hello there, I found your website by way of Google even as searching for a comparable matter, your website got here up, it appears great. I have bookmarked it in my google bookmarks.

  10. Have you ever thought about writing an ebook or guest authoring on other sites?

    I have a blog centered on the same information you discuss and would love to have
    you share some stories/information. I know my readers would appreciate your work.
    If you’re even remotely interested, feel free to send me an e-mail.

  11. Please let me know if you’re looking for a author for your weblog.

    You have some really good posts and I feel I would
    be a good asset. If you ever want to take some of the load off, I’d love to write some articles for your blog in exchange for a link back to mine.

    Please send me an email if interested. Cheers!

  12. Hey there! Someone in my Facebook group shared this website with us so I came to give it a look. I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers! Wonderful blog and terrific design.

  13. wonderful issues altogether, you just gained a brand
    new reader. What could you recommend about your submit that you simply made a
    few days ago? Any positive?

  14. you’re really a good webmaster. The website loading velocity is amazing. It kind of feels that you’re doing any distinctive trick. Moreover, The contents are masterwork. you’ve done a fantastic task on this subject!

  15. Thank you, I’ve recently been searching for info about this subject for ages and yours is the greatest I have found out so far. However, what concerning the bottom line? Are you sure concerning the source?

  16. Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!

  17. Great article and right to the point. I don’t know if this is truly the best place to ask but do you people have any ideea where to get some professional writers? Thank you 🙂

  18. Excellent post. I was checking constantly this blog and I am impressed! Extremely useful information particularly the last part 🙂 I care for such info a lot. I was looking for this certain information for a very long time. Thank you and good luck.

  19. Wow, awesome blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your website is fantastic, let alone the content!

  20. I savour, result in I found exactly what I was taking a look for. You’ve ended my four day long hunt! God Bless you man. Have a nice day. Bye

  21. This blog is definitely rather handy since I’m at the moment creating an internet floral website – although I am only starting out therefore it’s really fairly small, nothing like this site. Can link to a few of the posts here as they are quite. Thanks much. Zoey Olsen

  22. I found your weblog site on google and check a few of your early posts. Proceed to keep up the excellent operate. I simply additional up your RSS feed to my MSN Information Reader. Seeking forward to studying extra from you in a while!…

  23. Somebody essentially assist to make critically articles I might state. This is the very first time I frequented your website page and to this point? I surprised with the analysis you made to create this actual publish extraordinary. Magnificent task!

  24. Very nice info and straight to the point. I am not sure if this is in fact the best place to ask but do you people have any ideea where to employ some professional writers? Thanks in advance 🙂

  25. Oh my goodness! Impressive article dude! Thank you, However I
    am experiencing issues with your RSS. I don’t know why
    I can’t join it. Is there anybody else getting the same RSS
    issues? Anybody who knows the solution will you kindly
    respond? Thanks!!

  26. JUVEDERM由透明質酸Hyaluronic Acid(一種天然多醣體)製造而成,並具有幼滑及高凝聚力的配方。透明質酸(HA)是皮膚組織的主要成份之一,能自然存在於人體肌膚內 JUVEDERM所用的透明質酸非由動物身體提取,可鎖住水份保濕皮膚,從而增加皮膚密度並改善質感 Juvederm 玻尿酸 加強優化面部輪廓,可被身體完全吸引,能自然地修飾面部輪廓 功效可長達24個月以上 JUVEDERM的特點: 效果立即可見 非永久性 非手術性 安全有效 效果自然 JUVEDERM獲歐盟(CE)及美國及藥物管理局(FDA)認證 首先及唯一獲得FDA認證在首次療程後能維持長達一年2-4功效 新世代專員Hylacross科技為產品帶來獨特的物理特質,包括凝聚力、支撐力及柔順度 這是一套由全球著名醫學美容醫生Dr. Maurício de Maio,以JUVÉDERM®系列透明質酸產品為基礎而研發的面部優化療程,藉著簡單程序便達致面部優化效果,不需進行手術,減低風險。

  27. You really make it appear really easy together with your presentation however I find this matter to be really one thing which I believe I’d by no means understand. It kind of feels too complex and very broad for me. I’m taking a look ahead for your subsequent put up, I¦ll attempt to get the dangle of it!

  28. What i don’t realize is in truth how you’re no longer really a lot more well-preferred than you might be now. You’re very intelligent. You already know thus considerably in relation to this topic, made me individually imagine it from a lot of numerous angles. Its like men and women aren’t fascinated until it’s something to accomplish with Girl gaga! Your individual stuffs excellent. All the time deal with it up!

  29. I must show my gratitude for your generosity for all those that really want help on that question. Your very own commitment to passing the message all-around has been exceptionally practical and have regularly helped associates like me to arrive at their aims. Your own insightful guideline entails much to me and extremely more to my fellow workers. Best wishes; from each one of us.

  30. I just couldn’t depart your website prior to suggesting that I really enjoyed the standard information a person provide for your visitors? Is going to be back often in order to check up on new posts

  31. Thanks for sharing excellent informations. Your website is very cool. I’m impressed by the details that you have on this site. It reveals how nicely you perceive this subject. Bookmarked this web page, will come back for extra articles. You, my friend, ROCK! I found simply the info I already searched everywhere and simply couldn’t come across. What a perfect website.

  32. I was curious if you ever considered changing the
    layout 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 two images.

    Maybe you could space it out better?

  33. Pretty nice post. I just stumbled upon your blog and wanted to say that I have truly
    enjoyed browsing your blog posts. In any case I will be subscribing to your feed and
    I hope you write again soon!

  34. Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across. It extremely helps make reading your blog significantly easier.

  35. I believe this is among the such a lot important information for me. And i’m satisfied studying your article. But wanna observation on few common things, The website style is ideal, the articles is in reality excellent : D. Good job, cheers

  36. Hi there! This post couldn’t be written any better! Reading through this post reminds me of my previous room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thank you for sharing!

  37. I am now not sure where you’re getting your info, but great topic. I must spend some time studying much more or figuring out more. Thank you for great information I used to be on the lookout for this information for my mission.

  38. Its such as you read my thoughts! You seem to know a lot approximately this, like you wrote the guide in it or something. I think that you simply can do with some percent to drive the message home a bit, but other than that, this is great blog. A great read. I’ll certainly be back.

  39. I’ve recently started a web site, the info you offer on this website has helped me greatly. Thank you for all of your time & work. “Her grandmother, as she gets older, is not fading but rather becoming more concentrated.” by Paulette Bates Alden.

  40. Hi, I think your site might be having browser compatibility issues. When I look at your website in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, fantastic blog!


Lütfen yorumunuzu giriniz
Buraya isminizi giriniz