{"id":3049,"date":"2020-03-07T15:45:25","date_gmt":"2020-03-07T10:15:25","guid":{"rendered":"http:\/\/www.pythonpool.com\/?p=3049"},"modified":"2021-06-14T15:11:47","modified_gmt":"2021-06-14T09:41:47","slug":"python-ord","status":"publish","type":"post","link":"https:\/\/www.pythonpool.com\/python-ord\/","title":{"rendered":"What is Python ord Function | ord() Examples"},"content":{"rendered":"\n<p>Many times in Python programming while doing some projects. We need to find the corresponding <strong>Unicode<\/strong> value of a<strong> character. <\/strong> So the <strong>Python ord <\/strong>function returns the number representing the Unicode code of a specified character.<\/p>\n\n\n\n<p><strong>The Python ord Function is an inbuilt function which returns an integer representing the Unicode code of the specified character. In other words, in Python, every Unicode character has been assigned an integer number. So by using Python ord() built-in function, we can find out that integer number. By directly passing the Unicode character to this function as an argument.<\/strong><\/p>\n\n\n\n<p>Before discussing anything else, it is important to first know what the Unicode encoding is <\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #990303;color:#990303\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #990303;color:#990303\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Unicode_Encoding\" >Unicode Encoding<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Syntax_of_Python_ord_Function\" >Syntax of Python ord() Function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Parameters\" >Parameters<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Return_value_of_Python_ord_Function\" >Return value of Python ord() Function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Python_ord_Function_Examples\" >Python ord Function Examples<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Example_1_Converting_a_char_to_its_corresponding_ASCII_Unicode_value\" >Example 1: Converting a char to it\u2019s corresponding ASCII \/ Unicode value.<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Example_2_Finding_the_Unicode_Value_of_an_Empty_String\" >Example 2: Finding the Unicode Value of an Empty String<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Example_3_When_String_length_is_more_than_one\" >Example 3: When String length is more than one<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Example_4_The_Unicode_points_of_numbers_0-9_by_using_range_and_Python_ord\" >Example 4: The Unicode points of numbers 0-9 by using range and Python ord<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Example_5_Return_Unicode_code_Point_Value_From_a_User_Input\" >Example 5: Return Unicode code Point Value From a User Input<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Example_6_Python_Program_to_Get_the_Unicode_code_Point_Value_of_a_File_Using_Python_ord\" >Example 6: Python Program to Get the Unicode code Point Value of a File Using Python ord<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Example_7_Program_to_Return_Unicode_Values_of_all_the_Elements_Present_in_the_List\" >Example 7: Program to Return Unicode Values of all the Elements Present in the List<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Example_8_Using_List_comprehension_and_ord_function_in_Python_to_remove_all_characters_other_than_alphabets\" >Example 8: Using List comprehension and ord() function in Python to remove all characters other than alphabets.<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Must_Read\" >Must Read:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Unicode_Encoding\"><\/span>Unicode Encoding<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Unicode is a character encoding standard that has widespread acceptance. Microsoft software uses Unicode at its core. Whether you realize it or not, you are using Unicode already! Basically, \u201ccomputers just deal with numbers. They store letters and other characters by assigning a number for each one. Before Unicode was invented, there were hundreds of different encoding systems for assigning these numbers. No single encoding could contain enough characters.\u201d <\/p>\n\n\n\n<p>If you are using a legacy encoding your font conflicts with the font someone in another area of the world uses. You might have a <em>\u0170<\/em> in your font while someplace else someone used a <em>\u0190<\/em> at the same codepoint. Your files are incompatible. Unicode provides a unique number for every character and so you do not have this problem if you use Unicode. If your document calls for U+0289  it will be clear to any computer program what the character should be.<\/p>\n\n\n\n<h2 class=\"has-vivid-red-color has-text-color wp-block-heading\"><span class=\"ez-toc-section\" id=\"Syntax_of_Python_ord_Function\"><\/span>Syntax of Python ord() Function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The syntax of&nbsp;Python <code>ord()<\/code>&nbsp;is:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ord(ch)<\/pre>\n\n\n\n<h2 class=\"has-luminous-vivid-orange-color has-text-color wp-block-heading\"><span class=\"ez-toc-section\" id=\"Parameters\"><\/span>Parameters<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>Parameter:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table alignwide\"><table class=\"\"><tbody><tr><th>Name<\/th><th>Description<\/th><th>Required \/<br>Optional<\/th><th>Type<\/th><\/tr><tr><td>c<\/td><td>Any character of length 1.<\/td><td>Required<\/td><td>String<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"has-vivid-cyan-blue-color has-text-color wp-block-heading\"><span class=\"ez-toc-section\" id=\"Return_value_of_Python_ord_Function\"><\/span><strong>Return value of Python ord() Function<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The return value is an integer number that uniquely corresponds to or simply represent the provided Unicode Character.<\/p>\n\n\n\n<h2 class=\"has-vivid-green-cyan-color has-text-color wp-block-heading\"><span class=\"ez-toc-section\" id=\"Python_ord_Function_Examples\"><\/span>Python ord Function Examples<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Let&#8217;s move directly to the examples and see the working of the ord() function.<\/p>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" style=\"color:#761385\"><span class=\"ez-toc-section\" id=\"Example_1_Converting_a_char_to_its_corresponding_ASCII_Unicode_value\"><\/span>Example 1: Converting a char to it\u2019s corresponding ASCII \/ Unicode value.<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In the below example, the\u00a0<em>Python ord()<\/em>\u00a0function is used to return the number representing the Unicode code of a specified character.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print(ord('H'))\n\nprint(ord('a'))\n\nprint(ord('9'))\n\nprint(ord('#'))<\/code><\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>72\n97\n57\n35<\/code><\/pre>\n\n\n\n<p>So in the above example, we get the Unicode value of the corresponding character.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"872\" height=\"491\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture.jpg\" alt=\"Python ord() Function Example\" class=\"wp-image-3072\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture.jpg 872w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture-300x169.jpg 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture-768x432.jpg 768w\" sizes=\"(max-width: 872px) 100vw, 872px\" \/><\/figure>\n\n\n\n<p><strong>Note:<\/strong>  We can pass only one character as the parameter. The syntax can be ord(\u201ca\u201d) or ord(\u2018a\u2019), both will give the same results. <\/p>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" style=\"color:#761385\"><span class=\"ez-toc-section\" id=\"Example_2_Finding_the_Unicode_Value_of_an_Empty_String\"><\/span>Example 2: Finding the Unicode Value of an Empty String<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>So in this example, we are trying to find the Unicode \/ <a href=\"http:\/\/www.pythonpool.com\/python-ascii-to-string\/\" target=\"_blank\" rel=\"noopener\">ASCII<\/a> value of an empty string. Many of you guys may don&#8217;t know that there is a Unicode value of an empty string too. <\/p>\n\n\n\n<p>In this example, we have taken an empty string. And assigned it to <em>x<\/em>.<br>Further, with the help of Python ord() Function, we are finding the Unicode value of the empty string.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>x = ' '\nprint(ord(x))<\/code><\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>32<\/code><\/pre>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" style=\"color:#761385\"><span class=\"ez-toc-section\" id=\"Example_3_When_String_length_is_more_than_one\"><\/span>Example 3: When String length is more than one<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The\u00a0<em>Python ord()\u00a0method raises an <\/em>exception when the string length is more than one.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># inbuilt function return an \n# integer representing the Unicode code \n# demonstrating exception \n\nvalue1 = ord('AB') \n\n# prints the unicode value \nprint (value1) <\/code><\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Traceback (most recent call last):\n  File \"c:\/Users\/Karan\/Desktop\/test.py\", line 5, in &lt;module>\n    value1 = ord('AB')\nTypeError: ord() expected a character, but string of length 2 found<\/code><\/pre>\n\n\n\n<p><strong>If the string length is more then one, and a TypeError will be raised.<\/strong> <\/p>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" style=\"color:#761385\"><span class=\"ez-toc-section\" id=\"Example_4_The_Unicode_points_of_numbers_0-9_by_using_range_and_Python_ord\"><\/span>Example 4: <strong>The Unicode points of numbers 0-9 by using range <\/strong>and Python ord<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#Know Unicode code points of numbers by ord() function\nfor n in range(10):\n    print(\"Unicode code point of\", n, '=', ord(str(n)))<\/code><\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Unicode code point of 0 = 48\nUnicode code point of 1 = 49\nUnicode code point of 2 = 50\nUnicode code point of 3 = 51\nUnicode code point of 4 = 52\nUnicode code point of 5 = 53\nUnicode code point of 6 = 54\nUnicode code point of 7 = 55\nUnicode code point of 8 = 56\nUnicode code point of 9 = 57<\/code><\/pre>\n\n\n\n<p>In the above example,\u00a0a range\u00a0of 10 numbers\u00a0<strong>(0-9)<\/strong>\u00a0is created. A for loop is used to <a href=\"http:\/\/www.pythonpool.com\/python-iterate-through-list\/\" target=\"_blank\" rel=\"noreferrer noopener\">iterate<\/a> through the range. The ord Python function is used to display the code point of each number in the range.<\/p>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" style=\"color:#761385\"><span class=\"ez-toc-section\" id=\"Example_5_Return_Unicode_code_Point_Value_From_a_User_Input\"><\/span>Example 5: Return Unicode code Point Value From a User Input<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>For this example, the character is taken by the user by using the input function. Enter a single character and ord() function will return the Unicode code point of that character. Have a look:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>py_var = input(\"Enter a character:\")\n\npy_codepoint = ord(py_var)\n\nprint(\"The Unicode code point of the character\",py_var ,\"=\" ,py_codepoint)<\/code><\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Enter a character:K\nThe Unicode code point of the character K = 75<\/code><\/pre>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" style=\"color:#761385\"><span class=\"ez-toc-section\" id=\"Example_6_Python_Program_to_Get_the_Unicode_code_Point_Value_of_a_File_Using_Python_ord\"><\/span>Example 6: Python Program to Get the Unicode code Point Value of a File Using Python ord<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p> In this example, we are using Python ord() Function in a File. Here we will first open the file in the read-only mode. Then we will initialize a for loop and get the Unicode of all the characters present in the file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import sys\n\nfilename = sys.argv&#91;1]\n\nwith open(filename) as fh:\n   content = fh.read()\n\nfor c in content:\n   print(ord(c))<\/code><\/pre>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" style=\"color:#761385\"><span class=\"ez-toc-section\" id=\"Example_7_Program_to_Return_Unicode_Values_of_all_the_Elements_Present_in_the_List\"><\/span>Example 7: Program to Return Unicode Values of all the Elements Present in the List<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The\u00a0Python <em>ord()<\/em>\u00a0method can be used with iterables containing characters as elements.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MyList = &#91;'P', 'y', 't', 'h', 'o', 'n', 'P', 'o', 'o', 'l']\n\nfor i in MyList:\n  print(ord(i))<\/code><\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>80\n121\n116\n104\n111\n110\n80\n111\n111\n108<\/code><\/pre>\n\n\n\n<p>In this example, we get all the corresponding Unicode values of all the elements present in the list.<\/p>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" style=\"color:#761385\"><span class=\"ez-toc-section\" id=\"Example_8_Using_List_comprehension_and_ord_function_in_Python_to_remove_all_characters_other_than_alphabets\"><\/span>Example 8: Using List comprehension and ord() function in Python to remove all characters other than alphabets.<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The ord() function accepts a character as an argument and returns back the corresponding <a href=\"https:\/\/en.wikipedia.org\/wiki\/ASCII\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"ASCII (opens in a new tab)\">ASCII<\/a> value. This allows us in easy and quick comparison.<\/p>\n\n\n\n<p>Here we also implemented list comprehension which allows us to filter all the necessary elements of a list and club them together with the help of join function to get the desired output.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def remchar(input):\n\n# checking uppercase and lowercase characters\nfinal = &#91;ch for ch in input if\n(ord(ch) in range(ord('a'),ord('z')+1,1)) or (ord(ch) in\nrange(ord('A'),ord('Z')+1,1))]\n\nreturn ''.join(final)\n\nif __name__ == \"__main__\":\n   input = \"PythonPool@._\/?\"\n   print (remchar(input))<\/code><\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PythonPool<\/code><\/pre>\n\n\n\n<h2 class=\"has-pale-pink-color has-text-color wp-block-heading\"><span class=\"ez-toc-section\" id=\"Must_Read\"><\/span>Must Read:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"http:\/\/www.pythonpool.com\/python-lowercase\/\">How to Convert String to Lowercase in<\/a><\/li><li><a href=\"http:\/\/www.pythonpool.com\/square-root-in-python\/\">How to Calculate Square Root<\/a><\/li><li><a href=\"http:\/\/www.pythonpool.com\/python-user-input\/\">User Input | Input () Function | Keyboard Input<\/a><\/li><li><a href=\"http:\/\/www.pythonpool.com\/python-book\/\">Best Book to Learn Python in 2020<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Python ord function takes a single character as an input or a string of length 1 and returns the integer i.e Unicode equivalent code. The computer only understands these Unicode codes, Unicode codes are converted into binary which is used by the computer to process information.<\/p>\n\n\n\n<p>Python ord is something we need to know to effectively use Python. We can change characters by adding or <a href=\"http:\/\/www.pythonpool.com\/numpy-subtract\/\" target=\"_blank\" rel=\"noreferrer noopener\">subtracting<\/a> offset values.<\/p>\n\n\n\n<p>Try to run the programs on your side and let me know if you have any queries.<\/p>\n\n\n\n<p><strong><em>Happy Coding!<\/em><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many times in Python programming while doing some projects. We need to find the corresponding Unicode value of a character. So the Python ord function &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"What is Python ord Function | ord() Examples\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/python-ord\/#more-3049\" aria-label=\"More on What is Python ord Function | ord() Examples\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":3083,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4,15],"tags":[833,842,850,839,848,841,845,822,847,849,820,819,851,852,843,834,829,840,837,844,827,825,835,823,824,836,853,821,846,830],"class_list":["post-3049","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programs","category-tutorials","tag-chr-ord-python","tag-opposite-of-ord-in-python","tag-opposite-of-ord-python","tag-ord-and-chr-in-python","tag-ord-function-in-python","tag-ord-function-python","tag-ord-function-python-3","tag-ord-in-python","tag-ord-in-python-3","tag-ord-method-python","tag-ord-python","tag-ord-python-3","tag-ord-python-ascii","tag-ord-python-example","tag-ord-string-python","tag-ord-to-char-python","tag-orda-python","tag-python-3-ord","tag-python-chr-ord","tag-python-function-ord","tag-python-opposite-of-ord","tag-python-ord-and-chr","tag-python-ord-chr","tag-python-ord","tag-python-ord-function","tag-python-php-ord","tag-reverse-ord-python","tag-what-does-ord-do-in-python","tag-what-does-ord-stand-for-in-python","tag-what-is-ord-in-python","infinite-scroll-item"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v25.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is Python ord Function | ord() Examples - Python Pool<\/title>\n<meta name=\"description\" content=\"The Python ord Function is an inbuilt function which returns an integer representing the Unicode code of the specified character.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com\/python-ord\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Python ord Function | ord() Examples\" \/>\n<meta property=\"og:description\" content=\"Many times in Python programming while doing some projects. We need to find the corresponding Unicode value of a character. So the Python ord function\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/python-ord\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-07T10:15:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-14T09:41:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1017\" \/>\n\t<meta property=\"og:image:height\" content=\"615\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Python Pool\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Python Pool\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/python-ord\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-ord\/\"},\"author\":{\"name\":\"Python Pool\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998\"},\"headline\":\"What is Python ord Function | ord() Examples\",\"datePublished\":\"2020-03-07T10:15:25+00:00\",\"dateModified\":\"2021-06-14T09:41:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-ord\/\"},\"wordCount\":915,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-ord\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture-1.jpg\",\"keywords\":[\"chr ord python\",\"opposite of ord in python\",\"opposite of ord python\",\"ord and chr in python\",\"ord function in python\",\"ord function python\",\"ord function python 3\",\"ord in python\",\"ord in python 3\",\"ord method python\",\"ord python\",\"ord python 3\",\"ord python ascii\",\"ord python example\",\"ord string python\",\"ord to char python\",\"ord(a) python\",\"python 3 ord\",\"python chr ord\",\"python function ord\",\"python opposite of ord\",\"python ord and chr\",\"python ord chr\",\"python ord()\",\"python ord() function\",\"python php ord\",\"reverse ord python\",\"what does ord do in python\",\"what does ord stand for in python\",\"what is ord in python\"],\"articleSection\":[\"Programs\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/python-ord\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pythonpool.com\/python-ord\/\",\"url\":\"https:\/\/www.pythonpool.com\/python-ord\/\",\"name\":\"What is Python ord Function | ord() Examples - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-ord\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-ord\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture-1.jpg\",\"datePublished\":\"2020-03-07T10:15:25+00:00\",\"dateModified\":\"2021-06-14T09:41:47+00:00\",\"description\":\"The Python ord Function is an inbuilt function which returns an integer representing the Unicode code of the specified character.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-ord\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/python-ord\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/python-ord\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture-1.jpg\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture-1.jpg\",\"width\":1017,\"height\":615,\"caption\":\"python ord\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/python-ord\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What is Python ord Function | ord() Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pythonpool.com\/#website\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"name\":\"Python Pool\",\"description\":\"Your One-Stop Python Learning Destination\",\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pythonpool.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pythonpool.com\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/pythonpool\",\"https:\/\/www.youtube.com\/c\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998\",\"name\":\"Python Pool\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/fdd3cb9ad7f560324dfd481989550aa8ffce84388fd253c42beca35c999d3108?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/fdd3cb9ad7f560324dfd481989550aa8ffce84388fd253c42beca35c999d3108?s=96&d=wavatar&r=g\",\"caption\":\"Python Pool\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"What is Python ord Function | ord() Examples - Python Pool","description":"The Python ord Function is an inbuilt function which returns an integer representing the Unicode code of the specified character.","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:\/\/www.pythonpool.com\/python-ord\/","og_locale":"en_US","og_type":"article","og_title":"What is Python ord Function | ord() Examples","og_description":"Many times in Python programming while doing some projects. We need to find the corresponding Unicode value of a character. So the Python ord function","og_url":"https:\/\/www.pythonpool.com\/python-ord\/","og_site_name":"Python Pool","article_published_time":"2020-03-07T10:15:25+00:00","article_modified_time":"2021-06-14T09:41:47+00:00","og_image":[{"width":1017,"height":615,"url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture-1.jpg","type":"image\/jpeg"}],"author":"Python Pool","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Python Pool","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pythonpool.com\/python-ord\/#article","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/python-ord\/"},"author":{"name":"Python Pool","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998"},"headline":"What is Python ord Function | ord() Examples","datePublished":"2020-03-07T10:15:25+00:00","dateModified":"2021-06-14T09:41:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pythonpool.com\/python-ord\/"},"wordCount":915,"commentCount":0,"publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/www.pythonpool.com\/python-ord\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture-1.jpg","keywords":["chr ord python","opposite of ord in python","opposite of ord python","ord and chr in python","ord function in python","ord function python","ord function python 3","ord in python","ord in python 3","ord method python","ord python","ord python 3","ord python ascii","ord python example","ord string python","ord to char python","ord(a) python","python 3 ord","python chr ord","python function ord","python opposite of ord","python ord and chr","python ord chr","python ord()","python ord() function","python php ord","reverse ord python","what does ord do in python","what does ord stand for in python","what is ord in python"],"articleSection":["Programs","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pythonpool.com\/python-ord\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pythonpool.com\/python-ord\/","url":"https:\/\/www.pythonpool.com\/python-ord\/","name":"What is Python ord Function | ord() Examples - Python Pool","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pythonpool.com\/python-ord\/#primaryimage"},"image":{"@id":"https:\/\/www.pythonpool.com\/python-ord\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture-1.jpg","datePublished":"2020-03-07T10:15:25+00:00","dateModified":"2021-06-14T09:41:47+00:00","description":"The Python ord Function is an inbuilt function which returns an integer representing the Unicode code of the specified character.","breadcrumb":{"@id":"https:\/\/www.pythonpool.com\/python-ord\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pythonpool.com\/python-ord\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/python-ord\/#primaryimage","url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture-1.jpg","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/03\/Capture-1.jpg","width":1017,"height":615,"caption":"python ord"},{"@type":"BreadcrumbList","@id":"https:\/\/www.pythonpool.com\/python-ord\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"What is Python ord Function | ord() Examples"}]},{"@type":"WebSite","@id":"https:\/\/www.pythonpool.com\/#website","url":"https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/pythonpool","https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998","name":"Python Pool","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/fdd3cb9ad7f560324dfd481989550aa8ffce84388fd253c42beca35c999d3108?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fdd3cb9ad7f560324dfd481989550aa8ffce84388fd253c42beca35c999d3108?s=96&d=wavatar&r=g","caption":"Python Pool"}}]}},"_links":{"self":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/3049","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=3049"}],"version-history":[{"count":36,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/3049\/revisions"}],"predecessor-version":[{"id":24452,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/3049\/revisions\/24452"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/3083"}],"wp:attachment":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=3049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=3049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=3049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}