{"id":3951,"date":"2022-12-05T09:10:57","date_gmt":"2022-12-05T09:10:57","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=3951"},"modified":"2022-12-05T09:11:00","modified_gmt":"2022-12-05T09:11:00","slug":"python-from-keyword","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/python-from-keyword\/","title":{"rendered":"Python From Keyword"},"content":{"rendered":"<p style=\"text-align: center;\">The from keyword in Python<\/p>\n<p>Now, we are going to learn about the keyword, which is very useful in our programs. Basically, when we are required, to import only the specified section from a module, we can make use of the <strong>from <\/strong>keyword. Let\u2019s consider an example so that we can get a clearer picture of what the from keyword does.<\/p>\n<h2 style=\"text-align: center;\">Python From Keyword<\/h2>\n<p>Let\u2019s say that we want to import only the ceil method from the math module, in such a situation, we can make use of the from a keyword, and import only the required things from the math module. Let\u2019s have a look at a simple example, which demonstrates the same thing.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3952 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/THE-FROM-KEYWORD.jpg\" alt=\"\" width=\"641\" height=\"65\" srcset=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/THE-FROM-KEYWORD.jpg 641w, https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/THE-FROM-KEYWORD-300x30.jpg 300w\" sizes=\"auto, (max-width: 641px) 100vw, 641px\" \/><\/p>\n<p>As you can see in the above program, we have used the form a keyword, to import only the ceil method from the math class. So, this is often useful when we need to import only some specific section from some module. So, as and when required, we can make use of the from keyword in our programs, wherever we need to import only some section from the module. In order to have multiple sections imported from the keyword, we can simply separate them using the comma.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The from keyword in Python Now, we are going to learn about the keyword, which is very useful in our programs. Basically, when we are required, to import only the specified section from a module, we can make use of the from keyword. Let\u2019s consider an example so that we can get a clearer picture [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[26,27],"class_list":{"0":"post-3951","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-python-tutorial","7":"tag-python","8":"tag-python-tutorial"},"_links":{"self":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/comments?post=3951"}],"version-history":[{"count":2,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3951\/revisions"}],"predecessor-version":[{"id":4260,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3951\/revisions\/4260"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=3951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=3951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=3951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}