{"id":3712,"date":"2020-07-25T18:42:58","date_gmt":"2020-07-25T13:12:58","guid":{"rendered":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/?p=3712"},"modified":"2021-06-14T16:35:14","modified_gmt":"2021-06-14T11:05:14","slug":"python-chr","status":"publish","type":"post","link":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/","title":{"rendered":"Doing Exciting Stuff with Python chr() Function"},"content":{"rendered":"\n<p>In python, sometimes, we want to <strong>find the character when given an integer (generally ASCII values)<\/strong>. And for this purpose, we have chr() in python, which takes in the integer as the value gives the character as the value. The argument that can be given to its integer parameter is in <strong>range (0- 1,114,111).&nbsp;&nbsp;<\/strong><\/p>\n\n\n\n<p>For example- The chr value of integer 65 is \u2018A\u2019; for 92, the value is \u2018a.\u2019&nbsp;<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_65 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 \" >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-chr\/#Syntax_of_chr_python\" title=\"Syntax of chr() python&nbsp;\">Syntax of chr() python&nbsp;<\/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-chr\/#Some_Examples_of_Python_chr\" title=\"Some Examples of Python chr()&nbsp;\">Some Examples of Python chr()&nbsp;<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/python-chr\/#Printing_characters_from_integers_using_chr_python\" title=\"Printing characters from integers using chr() python-&nbsp;\">Printing characters from integers using chr() python-&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/python-chr\/#Print_characters_from_a_list_of_integers\" title=\"Print characters from a list of integers&nbsp;\">Print characters from a list of integers&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/python-chr\/#First_1000_characters\" title=\"First 1000 characters&nbsp;\">First 1000 characters&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/python-chr\/#When_do_we_Get_an_Error\" title=\"When do we Get an Error&nbsp;\">When do we Get an Error&nbsp;<\/a><\/li><\/ul><\/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-chr\/#Difference_between_chr_and_ord_in_python\" title=\"Difference between chr() and ord() in python&nbsp;\">Difference between chr() and ord() in python&nbsp;<\/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-chr\/#Encryption_and_Decryption_of_String_using_chr\" title=\"Encryption and Decryption of String using chr()&nbsp;\">Encryption and Decryption of String using chr()&nbsp;<\/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-chr\/#Must_Read\" title=\"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-10\" href=\"https:\/\/www.pythonpool.com\/python-chr\/#Conclusion\" title=\"Conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-syntax-of-chr-python\"><span class=\"ez-toc-section\" id=\"Syntax_of_chr_python\"><\/span>Syntax of chr() python&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>chr(n)&nbsp;<\/strong><\/p>\n\n\n\n<p>Here, \u2018n\u2019 is any value in the range of (0- 1,114,111). If we give negative number or number greater than the defined range, we will get an error saying- <strong>ValueError: chr() arg not in range(0x110000).&nbsp;<\/strong><\/p>\n\n\n\n<p>It takes only one<a href=\"https:\/\/en.wikipedia.org\/wiki\/Parameter_(computer_programming)\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\"> parameter<\/a>, and that is the number whose character value we want to find.&nbsp;&nbsp;<\/p>\n\n\n\n<p>If we want to find the character value for integer \u2013 65-&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ncharacter = chr(65)\nprint(character)\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\">Output-&nbsp;\nA&nbsp;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-some-examples-of-python-chr\"><span class=\"ez-toc-section\" id=\"Some_Examples_of_Python_chr\"><\/span>Some Examples of Python chr()&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-printing-characters-from-integers-using-chr-python\"><span class=\"ez-toc-section\" id=\"Printing_characters_from_integers_using_chr_python\"><\/span>Printing characters from integers using chr() python-&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\na=78\nb=102\nc=60\nprint(&quot;character value for&quot;,a,&quot;:&quot;,chr(a))\nprint(&quot;character value for&quot;,b,&quot;:&quot;,chr(b))\nprint(&quot;character value for&quot;,c,&quot;:&quot;,chr(c))\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"282\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/image-18-1024x282.png\" alt=\"python chr\" class=\"wp-image-3713\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/image-18-1024x282.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/image-18-300x83.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/image-18-768x211.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/image-18-1536x423.png 1536w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/image-18.png 1584w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Output-&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">character value for 78 : N\ncharacter value for 102 : f \ncharacter value for 60 : &lt;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-print-characters-from-a-list-of-integers\"><span class=\"ez-toc-section\" id=\"Print_characters_from_a_list_of_integers\"><\/span>Print characters from a list of integers&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nintegers=&#x5B;100,34,45,65,72,12]\nfor i in integers:\n    print(chr(i))\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\">Output-\nd\n\"\n-\nA\nH<\/pre>\n\n\n\n<p>We can also do something just like this-&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nintegers=&#x5B;100,34,45,65,72,12]\ncharacters=list(map(chr,integers))\nprint(characters)\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\">Output-&nbsp;\n['d', '\"', '-', 'A', 'H', '\\x0c']&nbsp;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-first-1000-characters\"><span class=\"ez-toc-section\" id=\"First_1000_characters\"><\/span>First 1000 characters&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Let us make a program to print all the characters which have ASCII value between 60 to 90. You can play with the numbers and change these values as you like. But keep in mind the range of values chr() accepts.&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nfor i in range(60,91):\n    print(&quot;ASCII VALUE:&quot;,i,&quot;Character:&quot;,chr(i))\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\">ASCII VALUE: 60 Character: &lt;\nASCII VALUE: 61 Character: =\nASCII VALUE: 62 Character: &gt;\nASCII VALUE: 63 Character: ?\nASCII VALUE: 64 Character: @\nASCII VALUE: 65 Character: A\nASCII VALUE: 66 Character: B\nASCII VALUE: 67 Character: C\n<a href=\"https:\/\/www.pythonpool.com\/python-ascii-to-string\/\" target=\"_blank\" rel=\"noopener\">ASCII<\/a> VALUE: 68 Character: D\nASCII VALUE: 69 Character: E\nASCII VALUE: 70 Character: F\nASCII VALUE: 71 Character: G\nASCII VALUE: 72 Character: H\nASCII VALUE: 73 Character: I\nASCII VALUE: 74 Character: J\nASCII VALUE: 75 Character: K\nASCII VALUE: 76 Character: L\nASCII VALUE: 77 Character: M\nASCII VALUE: 78 Character: N\nASCII VALUE: 79 Character: O\nASCII VALUE: 80 Character: P\nASCII VALUE: 81 Character: Q\nASCII VALUE: 82 Character: R\nASCII VALUE: 83 Character: S\nASCII VALUE: 84 Character: T\nASCII VALUE: 85 Character: U\nASCII VALUE: 86 Character: V\nASCII VALUE: 87 Character: W\nASCII VALUE: 88 Character: X\nASCII VALUE: 89 Character: Y\nASCII VALUE: 90 Character: Z<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-when-do-we-get-an-error\"><span class=\"ez-toc-section\" id=\"When_do_we_Get_an_Error\"><\/span>When do we Get an Error&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>We generally get an error when we try giving value which are not possible.&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n# too large a value\na=1234568297\nprint(chr(a))\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\">Output-&nbsp;\nValueError: chr() arg not in range(0x110000)&nbsp;<\/pre>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nb=-34\nprint(chr(b))\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\">Output-&nbsp;\nValueError: chr() arg not in range(0x110000)&nbsp;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-difference-between-chr-and-ord-in-python\"><span class=\"ez-toc-section\" id=\"Difference_between_chr_and_ord_in_python\"><\/span>Difference between chr() and ord() in python&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The counterpart of chr() in python is <a href=\"https:\/\/www.pythonpool.com\/python-ord\/\">ord()<\/a> function. Unlike chr(), ord() takes characters and gives integer values as output.&nbsp;<\/p>\n\n\n\n<p>Now let us make a program which changes the uppercase characters into lowercase using both chr() and ord().&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nstring=&quot;THESE CHARACTERS WILL GET CONVERTED INTO LOWERCASE&quot; \nnew_string=&quot;&quot; \nfor i in string: \n    \n   # 'ord' is used to find the ascii value \n    # The value of 'A' in ASCII is 65 and that of 'Z' is 90\n    if ord(i) &gt;=65 and ord(i)&lt;= 90: \n       #'chr' used to find the character from ascii value \n        new_string+=chr(ord(i)+32) \n    else: \n        new_string+=i \n        \nprint(&quot;Original string:&quot;,string)\nprint(&quot;New String:&quot;,new_string) \n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\">Output-&nbsp;\nOriginal string: THESE CHARACTERS WILL GET CONVERTED INTO LOWERCASE&nbsp;\nNew String: these characters will get converted into lowercase&nbsp;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-encryption-and-decryption-of-string-using-chr\"><span class=\"ez-toc-section\" id=\"Encryption_and_Decryption_of_String_using_chr\"><\/span>Encryption and Decryption of String using chr()&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Now let us use chr() and ord() in python to make a basic yet interesting program that can encrypt or decrypt a string. Encryption is the process of converting a plain text into a <a href=\"https:\/\/www.pythonpool.com\/caesar-cipher-python\/\" target=\"_blank\" rel=\"noreferrer noopener\">ciphered<\/a> text. Decryption is just the opposite of that. Here, we convert back a ciphered text to plain text.&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ndef encrypt(string):\n    \n    new_string=&quot;&quot; \n    for i in range(len(string)):\n        # If the charcter is in upper case\n        if (ord(string&#x5B;i]))&gt;=65 and (ord(string&#x5B;i]))&lt;=90:\n            encrypt_code=30\n            new_string+=chr(ord(string&#x5B;i])-encrypt_code)\n        # If the character is in lower case  \n        elif(ord(string&#x5B;i]))&gt;=97 and (ord(string&#x5B;i]))&lt;=122:\n            encrypt_code=60\n            new_string+=chr(ord(string&#x5B;i])+encrypt_code) \n        # Here we are assuming that the string consist of only letters and spaces\n        else:\n            new_string+=&quot; &quot;\n            \n    string=new_string\n    return string\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ndef decrypt(string):\n    new_string=&quot;&quot;\n    \n    for i in range(len(string)):\n        \n        if (ord(string&#x5B;i]))&gt;=35 and (ord(string&#x5B;i]))&lt;=60:\n            encrypt_code=30\n            new_string+=chr(ord(string&#x5B;i])+encrypt_code)\n            \n        elif(ord(string&#x5B;i]))&gt;=157 and (ord(string&#x5B;i]))&lt;=183:\n            encrypt_code=60\n            new_string+=chr(ord(string&#x5B;i])-encrypt_code)\n        else:\n            new_string+=&quot; &quot;\n            \n    string=new_string\n    return (new_string)\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nencrypted_string=encrypt(&quot;Python is the best&quot;)\nprint(&quot;encrypted string:&quot;,encrypted_string)\ndecrypted_string=decrypt(encrypted_string)\nprint(&quot;decrypted string:&quot;,decrypted_string)\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\"><strong>encrypted string: 2\u00b5\u00b0\u00a4\u00ab\u00aa \u00a5\u00af \u00b0\u00a4\u00a1 \u009e\u00a1\u00af\u00b0 <\/strong>\ndecrypted <strong>string: Python is the best<\/strong><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-must-read\"><span class=\"ez-toc-section\" id=\"Must_Read\"><\/span><span class=\"has-inline-color has-luminous-vivid-orange-color\">Must Read<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul><li><a href=\"https:\/\/www.pythonpool.com\/python-lowercase\/\">How to Convert String to Lowercase in<\/a><\/li><li><a href=\"https:\/\/www.pythonpool.com\/square-root-in-python\/\">How to Calculate Square Root<\/a><\/li><li><a href=\"https:\/\/www.pythonpool.com\/python-user-input\/\">User Input | Input () Function | Keyboard Input<\/a><\/li><li><a href=\"https:\/\/www.pythonpool.com\/python-book\/\">Best Book to Learn Python<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>We have studied almost everything about chr() in python. It is generally used for converting an ASCII value to a character. The counterpart for this is ord(), which saves a character into its ASCII value.<\/p>\n\n\n\n<p>Try to run the programs on your side and let us 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>In python, sometimes, we want to find the character when given an integer (generally ASCII values). And for this purpose, we have chr() in python, &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Doing Exciting Stuff with Python chr() Function\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/python-chr\/#more-3712\" aria-label=\"More on Doing Exciting Stuff with Python chr() Function\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":3716,"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":[15],"tags":[1712,1711,833,1710,1722,1714,1728,1721,839,1720,1713,1717,837,1715,1736,825,835,1716,1718,1719],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v22.4) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Doing Exciting Stuff with Python chr() Function - Python Pool<\/title>\n<meta name=\"description\" content=\"Python chr() can be used to convert any ASCII value into a character. It can be used with ord() to make programs like encryption and decryption.\" \/>\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-chr\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Doing Exciting Stuff with Python chr() Function\" \/>\n<meta property=\"og:description\" content=\"In python, sometimes, we want to find the character when given an integer (generally ASCII values). And for this purpose, we have chr() in python, which\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/python-chr\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-25T13:12:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-14T11:05:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/Capture-25.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"605\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ashwini Mandani\" \/>\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=\"Ashwini Mandani\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/python-chr\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-chr\/\"},\"author\":{\"name\":\"Ashwini Mandani\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/8a75fb48eb1f3dc952df65a8c28ac056\"},\"headline\":\"Doing Exciting Stuff with Python chr() Function\",\"datePublished\":\"2020-07-25T13:12:58+00:00\",\"dateModified\":\"2021-06-14T11:05:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-chr\/\"},\"wordCount\":440,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-chr\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/Capture-25.jpg\",\"keywords\":[\"chr function python\",\"chr in python\",\"chr ord python\",\"chr python\",\"chr() in python\",\"chr() python\",\"chr() python 3\",\"how to use chr in python\",\"ord and chr in python\",\"ord chr python\",\"python chr\",\"python chr function\",\"python chr ord\",\"python chr()\",\"python chr() function\",\"python ord and chr\",\"python ord chr\",\"python xname xname using ord and chr\",\"what does chr do in python\",\"what is chr in python\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/python-chr\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pythonpool.com\/python-chr\/\",\"url\":\"https:\/\/www.pythonpool.com\/python-chr\/\",\"name\":\"Doing Exciting Stuff with Python chr() Function - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-chr\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-chr\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/Capture-25.jpg\",\"datePublished\":\"2020-07-25T13:12:58+00:00\",\"dateModified\":\"2021-06-14T11:05:14+00:00\",\"description\":\"Python chr() can be used to convert any ASCII value into a character. It can be used with ord() to make programs like encryption and decryption.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-chr\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/python-chr\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/python-chr\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/Capture-25.jpg\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/Capture-25.jpg\",\"width\":1000,\"height\":605,\"caption\":\"python chr\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/python-chr\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Doing Exciting Stuff with Python chr() Function\"}]},{\"@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\":\"required name=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\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"https:\/\/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:\/\/twitter.com\/pythonpool\",\"https:\/\/www.youtube.com\/c\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/8a75fb48eb1f3dc952df65a8c28ac056\",\"name\":\"Ashwini Mandani\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/efd3e2763a755a226df4479ad87a5464?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/efd3e2763a755a226df4479ad87a5464?s=96&d=wavatar&r=g\",\"caption\":\"Ashwini Mandani\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Doing Exciting Stuff with Python chr() Function - Python Pool","description":"Python chr() can be used to convert any ASCII value into a character. It can be used with ord() to make programs like encryption and decryption.","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:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/","og_locale":"en_US","og_type":"article","og_title":"Doing Exciting Stuff with Python chr() Function","og_description":"In python, sometimes, we want to find the character when given an integer (generally ASCII values). And for this purpose, we have chr() in python, which","og_url":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/","og_site_name":"Python Pool","article_published_time":"2020-07-25T13:12:58+00:00","article_modified_time":"2021-06-14T11:05:14+00:00","og_image":[{"width":1000,"height":605,"url":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/Capture-25.jpg","type":"image\/jpeg"}],"author":"Ashwini Mandani","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Ashwini Mandani","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/#article","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/"},"author":{"name":"Ashwini Mandani","@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/#\/schema\/person\/8a75fb48eb1f3dc952df65a8c28ac056"},"headline":"Doing Exciting Stuff with Python chr() Function","datePublished":"2020-07-25T13:12:58+00:00","dateModified":"2021-06-14T11:05:14+00:00","mainEntityOfPage":{"@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/"},"wordCount":440,"commentCount":0,"publisher":{"@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/Capture-25.jpg","keywords":["chr function python","chr in python","chr ord python","chr python","chr() in python","chr() python","chr() python 3","how to use chr in python","ord and chr in python","ord chr python","python chr","python chr function","python chr ord","python chr()","python chr() function","python ord and chr","python ord chr","python xname xname using ord and chr","what does chr do in python","what is chr in python"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/","url":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/","name":"Doing Exciting Stuff with Python chr() Function - Python Pool","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/#primaryimage"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/Capture-25.jpg","datePublished":"2020-07-25T13:12:58+00:00","dateModified":"2021-06-14T11:05:14+00:00","description":"Python chr() can be used to convert any ASCII value into a character. It can be used with ord() to make programs like encryption and decryption.","breadcrumb":{"@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/#primaryimage","url":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/Capture-25.jpg","contentUrl":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/07\/Capture-25.jpg","width":1000,"height":605,"caption":"python chr"},{"@type":"BreadcrumbList","@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/python-chr\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"Doing Exciting Stuff with Python chr() Function"}]},{"@type":"WebSite","@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/#website","url":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","publisher":{"@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/twitter.com\/pythonpool","https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/#\/schema\/person\/8a75fb48eb1f3dc952df65a8c28ac056","name":"Ashwini Mandani","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/secure.gravatar.com\/avatar\/efd3e2763a755a226df4479ad87a5464?s=96&d=wavatar&r=g","contentUrl":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/secure.gravatar.com\/avatar\/efd3e2763a755a226df4479ad87a5464?s=96&d=wavatar&r=g","caption":"Ashwini Mandani"}}]}},"_links":{"self":[{"href":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/3712"}],"collection":[{"href":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=3712"}],"version-history":[{"count":7,"href":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/3712\/revisions"}],"predecessor-version":[{"id":24449,"href":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/3712\/revisions\/24449"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/3716"}],"wp:attachment":[{"href":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=3712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=3712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=3712"}],"curies":[{"name":"wp","href":"https:\/\/web.archive.org\/web\/20240926034911\/https:\/\/api.w.org\/{rel}","templated":true}]}}