{"id":2395,"date":"2015-02-20T13:15:06","date_gmt":"2015-02-20T11:15:06","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=2395"},"modified":"2015-02-16T00:24:28","modified_gmt":"2015-02-15T22:24:28","slug":"python-tutorial-strings-datatype","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/","title":{"rendered":"Python Tutorial: Strings Datatype"},"content":{"rendered":"<p>Data stored in memory can of different types and Python like other languages have different standard data types. Sometime back we did a post on<\/p>\n<p><a href=\"http:\/\/www.code2learn.com\/2011\/12\/python-tutorials-data-types-numbers.html\" target=\"_blank\">Python Numbers<\/a>. Today we will be covering other standard datatypes i.e. Strings.<\/p>\n<p><b><b>Note: All examples shown in the post are\u00a0based on <i>python3.<\/i><\/b><\/b><\/p>\n<p>Like other languages, python also has the same meaning\/definition for Strings.<\/p>\n<p><i>They are a contiguous set of characters enclosed within single\/double quotation marks<\/i>.<br \/>\n&nbsp;<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\"> \r\n#!\/usr\/bin\/python \r\nstrA = &quot;Hello &quot;\r\nstrB = 'World!'\r\n\r\n#Printing the above variables on screen\r\n\r\nprint strA #This will work in Python2\r\nprint strB #This will work in Python2\r\n\r\nprint( strA ) #This will work in Python3\r\nprint( strB ) #This will work in Python3 <\/pre>\n<figure id=\"attachment_2407\" aria-describedby=\"caption-attachment-2407\" style=\"width: 134px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.20.52-pm.png\"><img decoding=\"async\" class=\"size-full wp-image-2407\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.20.52-pm.png\" alt=\"Result of above Python3 Code\" width=\"134\" height=\"56\" \/><\/a><figcaption id=\"caption-attachment-2407\" class=\"wp-caption-text\">Result of above Python3 Code<\/figcaption><\/figure>\n<h3>String Slicing:<\/h3>\n<p>Strings can be sliced i.e. subsets of a string, using the slice operator ([:] or []). The index starts from 0.<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\"> \r\n#!\/usr\/bin\/python\r\n\r\nprint( strA&#x5B;0] )   #prints the first character of variable strA\r\nprint( strA&#x5B;1:3] ) #prints characters from first index to third\r\nprint( strA&#x5B;3:] )  #prints characters from third index <\/pre>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/lala.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-2408\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/lala.png\" alt=\"lala\" width=\"181\" height=\"89\" \/><\/a><\/p>\n<h3>String Concatenation:<\/h3>\n<p>Like other languages python also provides the functionality to concatenate strings. It is done its the\u00a0<b>+ operator<\/b>.<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#!\/usr\/bin\/python\r\n\r\nprint( &quot;Print Concatenated Output: &quot; + strA + strB ) <\/pre>\n<figure id=\"attachment_2409\" aria-describedby=\"caption-attachment-2409\" style=\"width: 422px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.35.53-pm.png\"><img decoding=\"async\" class=\"size-full wp-image-2409\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.35.53-pm.png\" alt=\"Code Output\" width=\"422\" height=\"29\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.35.53-pm.png 422w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.35.53-pm-300x21.png 300w\" sizes=\"(max-width: 422px) 100vw, 422px\" \/><\/a><figcaption id=\"caption-attachment-2409\" class=\"wp-caption-text\">Code Output<\/figcaption><\/figure>\n<p>If you try to concat another datatype using <b>+ operator<\/b>, you would get an error &#8221; <i>cannot convert &#8216;int&#8217; object to str implicitly<\/i>&#8220;. So to achieve that we have two ways:<\/p>\n<p>1. We can do by putting values using a comma inside <i>print()<\/i><\/p>\n<p>2. Other way, we can use an inbuilt function <b>str()<\/b>. This will convert any datatype to string thus, allowing us to use <b>+ operator<\/b><\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#!\/usr\/bin\/python \r\n\r\nprint( strA + 4 ) #This will give an error as mentioned above\r\n\r\n#Correct Way to Concat String and another Datatype\r\n\r\nprint( strA, 4 ) #Method 1\r\nprint( strA + str(1234) ) #Method 2 <\/pre>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.46.44-pm.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-2410\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.46.44-pm.png\" alt=\"Screen Shot 2015-01-20 at 7.46.44 pm\" width=\"483\" height=\"153\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.46.44-pm.png 483w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.46.44-pm-300x95.png 300w\" sizes=\"(max-width: 483px) 100vw, 483px\" \/><\/a><\/p>\n<h3>Escape Characters:<\/h3>\n<p>The definition an\u00a0<b>escape character<\/b> is a character which invokes an alternative interpretation on subsequent characters in a character sequence. It can be interpreted in a single as well as double quoted string.<\/p>\n<p>Below is the list of escape characters with their description:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.57.56-pm.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-2411\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.57.56-pm.png\" alt=\"Screen Shot 2015-01-20 at 7.57.56 pm\" width=\"411\" height=\"273\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.57.56-pm.png 411w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-7.57.56-pm-300x199.png 300w\" sizes=\"(max-width: 411px) 100vw, 411px\" \/><\/a><\/p>\n<h3>Some of the special operators<\/h3>\n<p>We only saw the\u00a0<b>+ operator<\/b>, but apart from this there are many others. Below is the list of all operators:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-8.04.11-pm.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-2412\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-8.04.11-pm.png\" alt=\"Screen Shot 2015-01-20 at 8.04.11 pm\" width=\"504\" height=\"256\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-8.04.11-pm.png 504w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/Screen-Shot-2015-01-20-at-8.04.11-pm-300x152.png 300w\" sizes=\"(max-width: 504px) 100vw, 504px\" \/><\/a><\/p>\n<p>Formatting Operator<\/p>\n<p>Formatting Operator\u00a0<b>%<\/b>, is one of the features which reminded me of the time when I used to write code in C. Here in python it functions the same way:<\/p>\n<p>Below is a list of formatting operators:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/re.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-2413\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/re.png\" alt=\"re\" width=\"318\" height=\"181\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/re.png 318w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/re-300x171.png 300w\" sizes=\"(max-width: 318px) 100vw, 318px\" \/><\/a><\/p>\n<p><b><span style=\"text-decoration: underline;\">Example:<\/span><\/b><\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#!\/usr\/bin\/python \r\n\r\n&quot;&quot;&quot;You can have multiple formatting operators, but remember the sequence of variables must be followed after % inside a bracket () separated by comma&quot;&quot;&quot;\r\n\r\nnum = 2\r\npost_num = 129\r\n\r\nprint( &quot;Code %s Learn&quot; %num) \r\n\r\nprint( &quot;Code %s Learn\\'s post number: %s&quot; %(num,post_num)) <\/pre>\n<figure id=\"attachment_2414\" aria-describedby=\"caption-attachment-2414\" style=\"width: 459px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/8.19.17-pm.png\"><img decoding=\"async\" class=\"size-full wp-image-2414\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/8.19.17-pm.png\" alt=\"String Formatting Example Output\" width=\"459\" height=\"72\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/8.19.17-pm.png 459w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/8.19.17-pm-300x47.png 300w\" sizes=\"(max-width: 459px) 100vw, 459px\" \/><\/a><figcaption id=\"caption-attachment-2414\" class=\"wp-caption-text\">String Formatting Example Output<\/figcaption><\/figure>\n<p>You must have noticed that I have used <b>Triple quotes<\/b>\u00a0in the above example. Triple quote is used for writing multi-line comments, whereas <b># <\/b>is used for writing a single line comment.<\/p>\n<p>Python also provides multiple built-in functions for String manipulations. Below is the gist of some functions:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/8.36.49-pm.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-2415\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/8.36.49-pm.png\" alt=\"8.36.49 pm\" width=\"839\" height=\"613\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/8.36.49-pm.png 839w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/01\/8.36.49-pm-300x219.png 300w\" sizes=\"(max-width: 839px) 100vw, 839px\" \/><\/a><\/p>\n<p>Check\u00a0<a href=\"https:\/\/docs.python.org\/2\/library\/string.html#deprecated-string-functions\" target=\"_blank\">Python Docs<\/a> for detailed reference.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/www.code2learn.com\/2015\/01\/python-tutorial-strings-datatype_20.html\">Python Tutorial: Strings Datatype<\/a> from our <a href=\"http:\/\/www.webcodegeeks.com\/wcg\/\">WCG partner<\/a> Farhan Khwaja at the <a href=\"http:\/\/www.code2learn.com\/\">Code 2 Learn<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Data stored in memory can of different types and Python like other languages have different standard data types. Sometime back we did a post on Python Numbers. Today we will be covering other standard datatypes i.e. Strings. Note: All examples shown in the post are\u00a0based on python3. Like other languages, python also has the same &hellip;<\/p>\n","protected":false},"author":54,"featured_media":1651,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[],"class_list":["post-2395","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python Tutorial: Strings Datatype - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Data stored in memory can of different types and Python like other languages have different standard data types. Sometime back we did a post on Python\" \/>\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.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Tutorial: Strings Datatype - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Data stored in memory can of different types and Python like other languages have different standard data types. Sometime back we did a post on Python\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-02-20T11:15:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Farhan Khwaja\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/Farhan_Khwaja\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Farhan Khwaja\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/\"},\"author\":{\"name\":\"Farhan Khwaja\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/63fa45b457fdf7462d27036c9cb32dcf\"},\"headline\":\"Python Tutorial: Strings Datatype\",\"datePublished\":\"2015-02-20T11:15:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/\"},\"wordCount\":565,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/\",\"name\":\"Python Tutorial: Strings Datatype - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"datePublished\":\"2015-02-20T11:15:06+00:00\",\"description\":\"Data stored in memory can of different types and Python like other languages have different standard data types. Sometime back we did a post on Python\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python Tutorial: Strings Datatype\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/63fa45b457fdf7462d27036c9cb32dcf\",\"name\":\"Farhan Khwaja\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/896cacfbf063e0865646575e4f5ed7802218dfb41d67b1fa206c42e62598b2e9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/896cacfbf063e0865646575e4f5ed7802218dfb41d67b1fa206c42e62598b2e9?s=96&d=mm&r=g\",\"caption\":\"Farhan Khwaja\"},\"description\":\"Farhan is a software engineer working in retail domain. He is an ETL\/UNIX\/Teradata developer. He is also the founder and editor of Code 2 Learn.\",\"sameAs\":[\"http:\/\/www.code2learn.com\/\",\"http:\/\/in.linkedin.com\/in\/khwajafarhan\",\"https:\/\/x.com\/http:\/\/twitter.com\/Farhan_Khwaja\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/farhan-khwaja\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Tutorial: Strings Datatype - Web Code Geeks - 2026","description":"Data stored in memory can of different types and Python like other languages have different standard data types. Sometime back we did a post on Python","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.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/","og_locale":"en_US","og_type":"article","og_title":"Python Tutorial: Strings Datatype - Web Code Geeks - 2026","og_description":"Data stored in memory can of different types and Python like other languages have different standard data types. Sometime back we did a post on Python","og_url":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2015-02-20T11:15:06+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","type":"image\/jpeg"}],"author":"Farhan Khwaja","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/Farhan_Khwaja","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Farhan Khwaja","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/"},"author":{"name":"Farhan Khwaja","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/63fa45b457fdf7462d27036c9cb32dcf"},"headline":"Python Tutorial: Strings Datatype","datePublished":"2015-02-20T11:15:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/"},"wordCount":565,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/","url":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/","name":"Python Tutorial: Strings Datatype - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","datePublished":"2015-02-20T11:15:06+00:00","description":"Data stored in memory can of different types and Python like other languages have different standard data types. Sometime back we did a post on Python","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/python\/python-tutorial-strings-datatype\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/www.webcodegeeks.com\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python Tutorial: Strings Datatype"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/63fa45b457fdf7462d27036c9cb32dcf","name":"Farhan Khwaja","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/896cacfbf063e0865646575e4f5ed7802218dfb41d67b1fa206c42e62598b2e9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/896cacfbf063e0865646575e4f5ed7802218dfb41d67b1fa206c42e62598b2e9?s=96&d=mm&r=g","caption":"Farhan Khwaja"},"description":"Farhan is a software engineer working in retail domain. He is an ETL\/UNIX\/Teradata developer. He is also the founder and editor of Code 2 Learn.","sameAs":["http:\/\/www.code2learn.com\/","http:\/\/in.linkedin.com\/in\/khwajafarhan","https:\/\/x.com\/http:\/\/twitter.com\/Farhan_Khwaja"],"url":"https:\/\/www.webcodegeeks.com\/author\/farhan-khwaja\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/2395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/54"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=2395"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/2395\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/1651"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=2395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=2395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=2395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}