{"id":3643,"date":"2022-12-01T20:56:59","date_gmt":"2022-12-01T20:56:59","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=3643"},"modified":"2022-12-01T20:57:00","modified_gmt":"2022-12-01T20:57:00","slug":"python-string-upper","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/python-string-upper\/","title":{"rendered":"Python String upper() Method"},"content":{"rendered":"<p style=\"text-align: center;\">Python String upper<\/p>\n<p>Now, we are going to learn about the upper method. As the name of the method suggests, the upper method returns the copy of the string, with all the alphabets from the string in uppercase. So, whenever we are required to have our string in uppercase, we can make use of the upper method. Remember that it returns a new string, with the alphabet converted to uppercase. 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-3644 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-upper-METHOD.jpg\" alt=\"\" width=\"631\" height=\"94\" srcset=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-upper-METHOD.jpg 631w, https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-upper-METHOD-300x45.jpg 300w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/p>\n<h2 style=\"text-align: center;\">Python String upper() Method<\/h2>\n<p>As you can see in the above program, we have a string, and then we are trying to call the upper method. This method returns a string, with the alphabet converted to uppercase. After that, we are printing the original string, as well as the converted string. Let\u2019s have a look at the output now.<\/p>\n<p>The original string:\u00a0 gyanipandit<br \/>\nThe string in the uppercase:\u00a0 GYANIPANDIT<\/p>\n<p>As you can see, we got the string converted in uppercase in the output. The original string is as it was. So, whenever we want to have our string in uppercase, we can make use of the upper method. Let\u2019s have a look at another program, through which, we would get a clearer idea about the upper method.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3645 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-upper-METHOD-1.jpg\" alt=\"\" width=\"632\" height=\"105\" srcset=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-upper-METHOD-1.jpg 632w, https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-upper-METHOD-1-300x50.jpg 300w\" sizes=\"auto, (max-width: 632px) 100vw, 632px\" \/><\/p>\n<p>As you can see in the above program, we again have a string, but this time, we have some alphabets which are already in uppercase. Let\u2019s have a look at the output now.<\/p>\n<p>The original string:\u00a0 GyaniPANDIT<br \/>\nThe string in the uppercase:\u00a0 GYANIPANDIT<\/p>\n<p>As you can see, this time as well, we got the string in the uppercase, and the original string is as it was. Also, Let\u2019s have a look at another example, in which, we have some characters other than alphabets. Let\u2019s have a look at the below program.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3646 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-upper-METHOD-2.jpg\" alt=\"\" width=\"625\" height=\"99\" srcset=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-upper-METHOD-2.jpg 625w, https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/10\/THE-upper-METHOD-2-300x48.jpg 300w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/p>\n<p>As you can see in the above program, we again have a string, but this time, in the string, we have some numbers as well. Let\u2019s have a look at the output now, so as to get a clearer picture.<\/p>\n<p>The original string:\u00a0 GyaniPandit123<br \/>\nThe string in the uppercase:\u00a0 GYANIPANDIT123<\/p>\n<p>As you can see, even if we had the numbers in the string, all the alphabets were converted to uppercase.<\/p>\n<p>So, as and when required, we can make use of the upper method in our python programs, so as to get a string, in which all the alphabets are in the uppercase. Remember that the upper method returns a string, with the alphabet converted in uppercase. The original string is as it was.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python String upper Now, we are going to learn about the upper method. As the name of the method suggests, the upper method returns the copy of the string, with all the alphabets from the string in uppercase. So, whenever we are required to have our string in uppercase, we can make use of the [&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-3643","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\/3643","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=3643"}],"version-history":[{"count":2,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3643\/revisions"}],"predecessor-version":[{"id":4177,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3643\/revisions\/4177"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=3643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=3643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=3643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}