{"id":2682,"date":"2024-11-02T01:00:15","date_gmt":"2024-11-01T22:00:15","guid":{"rendered":"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/"},"modified":"2024-11-02T01:00:15","modified_gmt":"2024-11-01T22:00:15","slug":"pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma","status":"publish","type":"post","link":"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/","title":{"rendered":"Python&#8217;da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma"},"content":{"rendered":"<p>Python&#8217;da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma<\/p>\n<p>Python&#8217;da &#8220;__name__&#8221; ve &#8220;__main__&#8221; kavramlar\u0131, \u00f6zellikle bir script&#8217;in nas\u0131l \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 ve mod\u00fcllerin nas\u0131l i\u00e7e aktar\u0131ld\u0131\u011f\u0131n\u0131 anlamak i\u00e7in \u00f6nemlidir. Bu kavramlar\u0131 anlamak, kodunuzu daha iyi organize etmenizi, tekrarlayan kodu \u00f6nlemenizi ve mod\u00fcler bir \u015fekilde geli\u015ftirmenizi sa\u011flar.<\/p>\n<h2>__name__ \u00d6zelli\u011fi<\/h2>\n<p>Her Python dosyas\u0131 (mod\u00fcl) &#8220;__name__&#8221; ad\u0131nda \u00f6zel bir de\u011fi\u015fkene sahiptir. &#8220;__name__&#8221; de\u011fi\u015fkeni, dosyan\u0131n nas\u0131l \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131na ba\u011fl\u0131 olarak farkl\u0131 bir de\u011fer al\u0131r.<\/p>\n<ul>\n<li> **Dosya do\u011frudan \u00e7al\u0131\u015ft\u0131r\u0131l\u0131yorsa:** &#8220;__name__&#8221; de\u011fi\u015fkeni &#8220;__main__&#8221; de\u011ferini al\u0131r. <\/li>\n<li> **Dosya bir mod\u00fcl olarak i\u00e7e aktar\u0131l\u0131yorsa:** &#8220;__name__&#8221; de\u011fi\u015fkeni dosyan\u0131n ad\u0131n\u0131 al\u0131r. <\/li>\n<\/ul>\n<p>Bu davran\u0131\u015f, kodunuzu ko\u015fullu olarak \u00e7al\u0131\u015ft\u0131rmak i\u00e7in kullan\u0131labilir. \u00d6rne\u011fin, bir script&#8217;in do\u011frudan \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131nda \u00e7al\u0131\u015fmas\u0131 gereken kodlar\u0131 ve bir mod\u00fcl olarak i\u00e7e aktar\u0131ld\u0131\u011f\u0131nda \u00e7al\u0131\u015fmas\u0131 gereken kodlar\u0131 ay\u0131rabilirsiniz.<\/p>\n<h2>__main__ Blo\u011fu<\/h2>\n<p> &#8220;__main__&#8221; blo\u011fu, Python&#8217;da bir script&#8217;in nas\u0131l \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 anlamak i\u00e7in kullan\u0131lan temel bir yap\u0131d\u0131r. Bu blok, script&#8217;in do\u011frudan \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131 zaman \u00e7al\u0131\u015ft\u0131r\u0131lan kodlar\u0131 i\u00e7erir.<\/p>\n<p> &#8220;__main__&#8221; blo\u011fu, if ko\u015fulu kullan\u0131larak olu\u015fturulur:<\/p>\n<p>&#8220;`python<br \/>\nif __name__ == &#8220;__main__&#8221;:<br \/>\n  # Bu kod sadece script do\u011frudan \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131nda \u00e7al\u0131\u015f\u0131r<br \/>\n&#8220;`<\/p>\n<p> &#8220;__main__&#8221; blo\u011fu genellikle a\u015fa\u011f\u0131daki gibi kullan\u0131labilir:<\/p>\n<ul>\n<li> **Script&#8217;in ba\u015flang\u0131\u00e7 i\u015flemleri:** Bu blok, script&#8217;in ba\u015flang\u0131\u00e7 i\u015flemlerini (\u00f6rne\u011fin, giri\u015f dosyalar\u0131n\u0131n okunmas\u0131, de\u011fi\u015fkenlerin tan\u0131mlanmas\u0131, fonksiyonlar\u0131n \u00e7a\u011fr\u0131lmas\u0131) ger\u00e7ekle\u015ftirmek i\u00e7in kullan\u0131labilir.<\/li>\n<li> **Test kodlar\u0131:**  Test kodlar\u0131 &#8220;__main__&#8221; blo\u011fu i\u00e7inde yerle\u015ftirilebilir, \u00e7\u00fcnk\u00fc bu kodlar sadece script do\u011frudan \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131nda \u00e7al\u0131\u015f\u0131r.<\/li>\n<li> **Komut sat\u0131r\u0131 arg\u00fcmanlar\u0131n\u0131 i\u015fleme:** Bu blok, script&#8217;e komut sat\u0131r\u0131 arg\u00fcmanlar\u0131n\u0131 i\u015fleme ve bunlar\u0131 kullanma imkan\u0131 sa\u011flar.<\/li>\n<\/ul>\n<h2>Mod\u00fcllerin \u0130\u00e7e Aktarma<\/h2>\n<p> &#8220;__name__&#8221; \u00f6zelli\u011fi, mod\u00fcllerin nas\u0131l i\u00e7e aktar\u0131ld\u0131\u011f\u0131n\u0131 ve nas\u0131l \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 anlamak i\u00e7in de kullan\u0131l\u0131r.  Python&#8217;da bir mod\u00fcl\u00fc i\u00e7e aktar\u0131rken, o mod\u00fcl\u00fcn &#8220;__name__&#8221; \u00f6zelli\u011fi mod\u00fcl\u00fcn ad\u0131n\u0131 al\u0131r.<\/p>\n<p>\u00d6rne\u011fin, bir &#8220;mymodule.py&#8221; adl\u0131 bir dosyam\u0131z oldu\u011funu varsayal\u0131m. Bu dosyay\u0131 &#8220;main.py&#8221; adl\u0131 bir di\u011fer dosyadan i\u00e7e aktard\u0131\u011f\u0131m\u0131zda, &#8220;mymodule.py&#8221; dosyas\u0131n\u0131n &#8220;__name__&#8221; \u00f6zelli\u011fi &#8220;mymodule&#8221; olacakt\u0131r.  &#8220;main.py&#8221; dosyas\u0131ndan &#8220;mymodule.py&#8221; dosyas\u0131n\u0131 do\u011frudan \u00e7al\u0131\u015ft\u0131r\u0131rsak, &#8220;mymodule.py&#8221; dosyas\u0131n\u0131n &#8220;__name__&#8221; \u00f6zelli\u011fi &#8220;__main__&#8221; olacakt\u0131r.<\/p>\n<h2>Uygulamalar<\/h2>\n<p> &#8220;__name__&#8221; ve &#8220;__main__&#8221; \u00f6zellikleri, Python&#8217;da bir\u00e7ok farkl\u0131 kullan\u0131m alan\u0131na sahiptir. \u0130\u015fte birka\u00e7 \u00f6rnek:<\/p>\n<ul>\n<li> **Fonksiyonlar\u0131n Test Edilmesi:**  &#8220;__main__&#8221; blo\u011fu, fonksiyonlar\u0131 do\u011frudan \u00e7al\u0131\u015ft\u0131rarak test etmek i\u00e7in ideal bir yerdir.<\/li>\n<li> **Script&#8217;i Komut Sat\u0131r\u0131 Arac\u0131l\u0131\u011f\u0131yla \u00c7al\u0131\u015ft\u0131rma:**  &#8220;__main__&#8221; blo\u011fu, script&#8217;e komut sat\u0131r\u0131 arg\u00fcmanlar\u0131 almas\u0131n\u0131 sa\u011flar.<\/li>\n<li> **Mod\u00fcler Kod Geli\u015ftirme:** &#8220;__name__&#8221; \u00f6zelli\u011fi, mod\u00fcl\u00fcn nas\u0131l \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 anlamak ve ko\u015fullu olarak kodlar\u0131 \u00e7al\u0131\u015ft\u0131rmak i\u00e7in kullan\u0131labilir.<\/li>\n<\/ul>\n<h2>\u00d6rnek Kod<\/h2>\n<p>&#8220;`python<br \/>\n# mymodule.py<\/p>\n<p>def greet(name):<br \/>\n  print(f&#8221;Merhaba {name}!&#8221;)<\/p>\n<p>if __name__ == &#8220;__main__&#8221;:<br \/>\n  greet(&#8220;Fatih&#8221;)<br \/>\n&#8220;`<\/p>\n<p>&#8220;`python<br \/>\n# main.py<\/p>\n<p>import mymodule<\/p>\n<p>mymodule.greet(&#8220;Soysal&#8221;)<br \/>\n&#8220;`<\/p>\n<p>Bu \u00f6rnekte, &#8220;mymodule.py&#8221; dosyas\u0131 bir mod\u00fcl olarak i\u00e7e aktar\u0131l\u0131r ve &#8220;main.py&#8221; dosyas\u0131 &#8220;mymodule.py&#8221; dosyas\u0131ndaki &#8220;greet&#8221; fonksiyonunu \u00e7a\u011f\u0131r\u0131r.  &#8220;mymodule.py&#8221; dosyas\u0131nda &#8220;greet&#8221; fonksiyonunun do\u011frudan \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 g\u00f6rmek i\u00e7in &#8220;mymodule.py&#8221; dosyas\u0131n\u0131 do\u011frudan \u00e7al\u0131\u015ft\u0131rabilirsiniz.  Bu durumda, &#8220;mymodule.py&#8221; dosyas\u0131ndaki &#8220;if __name__ == &#8220;__main__&#8221;: &#8221; blo\u011fu \u00e7al\u0131\u015facak ve &#8220;greet(&#8220;Fatih&#8221;)&#8221; fonksiyonunu \u00e7a\u011f\u0131racakt\u0131r.<\/p>\n<h2>Sonu\u00e7<\/h2>\n<p> &#8220;__name__&#8221; ve &#8220;__main__&#8221; \u00f6zellikleri, Python&#8217;da script&#8217;lerin nas\u0131l \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 ve mod\u00fcllerin nas\u0131l i\u00e7e aktar\u0131ld\u0131\u011f\u0131n\u0131 anlamak i\u00e7in \u00f6nemlidir. Bu kavramlar\u0131 anlamak, daha iyi organize edilmi\u015f, tekrarlayan kodlar\u0131 olmayan ve mod\u00fcler bir \u015fekilde geli\u015ftirilmi\u015f kodlar yazman\u0131za yard\u0131mc\u0131 olur. <\/p>\n<p>Daha fazla bilgi edinmek i\u00e7in a\u015fa\u011f\u0131daki kaynaklar\u0131 ziyaret edebilirsiniz:<\/p>\n<ul>\n<li><a href=\"https:\/\/dev.to\/pawandeore\/mastering-pythons-name-and-main-understanding-script-execution-and-module-imports-266g\">Mastering Python&#8217;s __name__ and __main__: Understanding Script Execution and Module Imports<\/a><\/li>\n<li><a href=\"https:\/\/fatihsoysal.com\">Fatih Soysal&#8217;\u0131n Web Sitesi<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"Python&#8217;da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma Python&#8217;da &#8220;__name__&#8221; ve &#8220;__main__&#8221; kavramlar\u0131, \u00f6zellikle bir script&#8217;in&hellip;","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_page_header_type":"","csco_page_load_nextpost":"","csco_page_subscribe_form":"","csco_page_contact_form":"","footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-2682","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-genel","7":"cs-entry","8":"cs-video-wrap"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.5 (Yoast SEO v25.3.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python&#039;da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma<\/title>\n<meta name=\"description\" content=\"Python&#039;da &quot;__name__&quot; ve &quot;__main__&quot; kavramlar\u0131, \u00f6zellikle bir script&#039;in nas\u0131l \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 ve mod\u00fcllerin nas\u0131l i\u00e7e aktar\u0131ld\u0131\u011f\u0131n\u0131 anlamak i\u00e7in \u00f6nemlidir. Bu kavramlar\u0131 anlamak, kodunuzu daha iyi organize etmenizi, tekrarlayan kodu \u00f6nlemenizi ve mod\u00fcler bir \u015fekilde geli\u015ftirmenizi sa\u011flar.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python&#039;da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma\" \/>\n<meta property=\"og:description\" content=\"Python&#039;da &quot;__name__&quot; ve &quot;__main__&quot; kavramlar\u0131, \u00f6zellikle bir script&#039;in nas\u0131l \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 ve mod\u00fcllerin nas\u0131l i\u00e7e aktar\u0131ld\u0131\u011f\u0131n\u0131 anlamak i\u00e7in \u00f6nemlidir. Bu kavramlar\u0131 anlamak, kodunuzu daha iyi organize etmenizi, tekrarlayan kodu \u00f6nlemenizi ve mod\u00fcler bir \u015fekilde geli\u015ftirmenizi sa\u011flar.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/\" \/>\n<meta property=\"og:site_name\" content=\"Kodlar\u0131n Gizemli D\u00fcnyas\u0131\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T22:00:15+00:00\" \/>\n<meta name=\"author\" content=\"Fatih Soysal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fatih Soysal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/\"},\"author\":{\"name\":\"Fatih Soysal\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"headline\":\"Python&#8217;da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma\",\"datePublished\":\"2024-11-01T22:00:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/\"},\"wordCount\":745,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/#respond\"]}],\"copyrightYear\":\"2024\",\"copyrightHolder\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/\",\"name\":\"Python'da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\"},\"datePublished\":\"2024-11-01T22:00:15+00:00\",\"description\":\"Python'da \\\"__name__\\\" ve \\\"__main__\\\" kavramlar\u0131, \u00f6zellikle bir script'in nas\u0131l \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 ve mod\u00fcllerin nas\u0131l i\u00e7e aktar\u0131ld\u0131\u011f\u0131n\u0131 anlamak i\u00e7in \u00f6nemlidir. Bu kavramlar\u0131 anlamak, kodunuzu daha iyi organize etmenizi, tekrarlayan kodu \u00f6nlemenizi ve mod\u00fcler bir \u015fekilde geli\u015ftirmenizi sa\u011flar.\",\"breadcrumb\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Anasayfa\",\"item\":\"https:\/\/fatihsoysal.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python&#8217;da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/\",\"name\":\"Fatihsoysal.com\",\"description\":\"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim\",\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"tr\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\",\"name\":\"Fatih Soysal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"contentUrl\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"width\":512,\"height\":512,\"caption\":\"Fatih Soysal\"},\"logo\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python'da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma","description":"Python'da \"__name__\" ve \"__main__\" kavramlar\u0131, \u00f6zellikle bir script'in nas\u0131l \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 ve mod\u00fcllerin nas\u0131l i\u00e7e aktar\u0131ld\u0131\u011f\u0131n\u0131 anlamak i\u00e7in \u00f6nemlidir. Bu kavramlar\u0131 anlamak, kodunuzu daha iyi organize etmenizi, tekrarlayan kodu \u00f6nlemenizi ve mod\u00fcler bir \u015fekilde geli\u015ftirmenizi sa\u011flar.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/","og_locale":"tr_TR","og_type":"article","og_title":"Python'da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma","og_description":"Python'da \"__name__\" ve \"__main__\" kavramlar\u0131, \u00f6zellikle bir script'in nas\u0131l \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 ve mod\u00fcllerin nas\u0131l i\u00e7e aktar\u0131ld\u0131\u011f\u0131n\u0131 anlamak i\u00e7in \u00f6nemlidir. Bu kavramlar\u0131 anlamak, kodunuzu daha iyi organize etmenizi, tekrarlayan kodu \u00f6nlemenizi ve mod\u00fcler bir \u015fekilde geli\u015ftirmenizi sa\u011flar.","og_url":"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/","og_site_name":"Kodlar\u0131n Gizemli D\u00fcnyas\u0131","article_published_time":"2024-11-01T22:00:15+00:00","author":"Fatih Soysal","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Fatih Soysal","Tahmini okuma s\u00fcresi":"4 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/#article","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/"},"author":{"name":"Fatih Soysal","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"headline":"Python&#8217;da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma","datePublished":"2024-11-01T22:00:15+00:00","mainEntityOfPage":{"@id":"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/"},"wordCount":745,"commentCount":0,"publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"inLanguage":"tr","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/#respond"]}],"copyrightYear":"2024","copyrightHolder":{"@id":"https:\/\/fatihsoysal.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/","url":"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/","name":"Python'da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/#website"},"datePublished":"2024-11-01T22:00:15+00:00","description":"Python'da \"__name__\" ve \"__main__\" kavramlar\u0131, \u00f6zellikle bir script'in nas\u0131l \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131n\u0131 ve mod\u00fcllerin nas\u0131l i\u00e7e aktar\u0131ld\u0131\u011f\u0131n\u0131 anlamak i\u00e7in \u00f6nemlidir. Bu kavramlar\u0131 anlamak, kodunuzu daha iyi organize etmenizi, tekrarlayan kodu \u00f6nlemenizi ve mod\u00fcler bir \u015fekilde geli\u015ftirmenizi sa\u011flar.","breadcrumb":{"@id":"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fatihsoysal.com\/blog\/pythonda-__name__-ve-__main__-script-calistirma-ve-modul-ice-aktarma\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Anasayfa","item":"https:\/\/fatihsoysal.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python&#8217;da __name__ ve __main__: Script \u00c7al\u0131\u015ft\u0131rma ve Mod\u00fcl \u0130\u00e7e Aktarma"}]},{"@type":"WebSite","@id":"https:\/\/fatihsoysal.com\/blog\/#website","url":"https:\/\/fatihsoysal.com\/blog\/","name":"Fatihsoysal.com","description":"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim","publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"tr"},{"@type":["Person","Organization"],"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1","name":"Fatih Soysal","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","contentUrl":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","width":512,"height":512,"caption":"Fatih Soysal"},"logo":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/"},"description":"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.","url":"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/"}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/2682","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/comments?post=2682"}],"version-history":[{"count":0,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/2682\/revisions"}],"wp:attachment":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/media?parent=2682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/categories?post=2682"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/tags?post=2682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}