{"id":21495,"date":"2020-08-21T12:03:17","date_gmt":"2020-08-21T19:03:17","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=21495"},"modified":"2023-12-01T03:58:06","modified_gmt":"2023-12-01T11:58:06","slug":"python-syntaxerror-unexpected-character-after-line-continuation-character","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/","title":{"rendered":"Python SyntaxError: unexpected character after line continuation character Solution"},"content":{"rendered":"\n<p>The Python line continuation character lets you continue a line of code on a new line in your program. The line continuation character cannot be followed by any value.<br><\/p>\n\n\n\n<p>If you specify a character or statement after a line continuation character, you encounter the \u201cSyntaxError: unexpected character after line continuation character\u201d error.<br><\/p>\n\n\n\n<p>In this guide, we talk about what this error means and why it is raised. We walk through two examples of this error in action so you can learn how to use it in your code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SyntaxError: unexpected character after line continuation character<\/h2>\n\n\n\n<p>The line continuation character lets you write a long string over multiple lines of code. This character is useful because it makes code easier to read. The line continuation character is a backslash (\u201c\\\u201d).<br><\/p>\n\n\n\n<p>Whereas it can be hard to follow a really long line of code, one line of code divided across multiple lines is easier to follow.<br><\/p>\n\n\n\n<p>The line continuation character is commonly used to break up code or to write a long string across multiple lines of code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>url = &quot;https:\/\/careerkarma.com&quot; \\\n      &quot;\/blog\/python-syntaxerror-unexpected-character-after&quot; \\\n      &quot;line-continuation-character&quot;<\/pre><\/div>\n\n\n\n<p>We have broken up our string into three lines. This makes it easier to read our code.<br><\/p>\n\n\n\n<p>Two scenarios when this error could be raised include:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Using a backslash instead of a forward slash as a <a href=\"https:\/\/careerkarma.com\/blog\/python-math-operators\/\">division operator<\/a><\/li><li>Adding a new line to a string without enclosing the <a href=\"https:\/\/careerkarma.com\/blog\/python-print-without-new-line\/\">new line character<\/a> in parenthesis<\/li><\/ul>\n\n\n\n<p>We\u2019ll talk through each of these scenarios one-by-one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Scenario #1: Division Using a Backslash<\/h2>\n\n\n\n<p>Here, we write a program that calculates a person\u2019s body mass index (BMI). To start, we need to ask a user to insert their height and weight into a Python program:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>height = input(&quot;What is your height? &quot;)\nweight = input(&quot;What is your weight? &quot;)<\/pre><\/div>\n\n\n\n<p>Next, we calculate the user\u2019s BMI. The formula for calculating a BMI value is:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>BMI = kg\/m2<\/pre><\/div>\n\n\n\n<p>\u201cKg\u201d is a person\u2019s weight in kilograms. \u201cm<sup>2<\/sup>\u201d is the height of a person squared. Translated into Python, the formula to calculate a BMI looks like this:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>bmi = float(weight) \\ (float(height) * 2)\nprint(&quot;Your BMI is: &quot; + str(bmi))<\/pre><\/div>\n\n\n\n<p>We convert the values of \u201cweight\u201d and \u201cheight\u201d to <a href=\"https:\/\/careerkarma.com\/blog\/python-float\/\">floating point numbers<\/a> so that we can perform mathematical functions on them.<br><\/p>\n\n\n\n<p>We then print a user\u2019s BMI to the console. We convert \u201cbmi\u201d to a string using the str() method so that we can <a href=\"https:\/\/careerkarma.com\/blog\/python-concatenate-strings\/\">concatenate<\/a> it to the \u201cYour BMI is: \u201d message. We round the value of \u201cbmi\u201d to two decimal places using the round() method.<br><\/p>\n\n\n\n<p>Let\u2019s run our code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>  File &quot;main.py&quot;, line 4\n\tbmi = float(weight) \\ (float(height) * 2)\n                                        \t^\nSyntaxError: unexpected character after line continuation character<\/pre><\/div>\n\n\n\n<p>We\u2019ve encountered an error. This is because we have used \u201c\\\u201d as the division operator instead of the \u201c\/\u201d sign. We can fix our code by using the \u201c\/\u201d division operator:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>bmi = float(weight) \/ (float(height) * 2)\nprint(&quot;Your BMI is: &quot; + str(round(bmi, 2)))<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>What is your height? 1.70\nWhat is your weight? 63\nYour BMI is: 18.53<\/pre><\/div>\n\n\n\n<p>Our code has successfully calculated the BMI of a user.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Scenario #2: Using the New Line Character Incorrectly<\/h2>\n\n\n\n<p>Next, we write a program that writes a list of ingredients to a file. We start by defining a list of ingredients for a shortbread recipe:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>ingredients = [\n\t&quot;150g plain flour&quot;,\n\t&quot;100g butter, chilled an cubed&quot;,\n\t&quot;50g caster sugar&quot;\n]<\/pre><\/div>\n\n\n\n<p>Next, we open up a file called \u201cshortbread_recipe.txt\u201d to which we will write our list of ingredients:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>with open(&quot;shortbread_recipe.txt&quot;, &quot;w+&quot;) as ingredients_file:\n\tfor i in ingredients:\n\t\tingredients_file.write(i + \\n)<\/pre><\/div>\n\n\n\n<p>This code loops through every ingredient in the \u201cingredients\u201d variable. Each ingredient is written to the ingredients file followed by a new line character in Python (\u201c\\n\u201d). This makes sure that each ingredient appears on a new line.<br><\/p>\n\n\n\n<p>Let\u2019s run our Python code:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>  File &quot;main.py&quot;, line 9\n\tingredients_file.write(i + \\n)\n                             \t^\nSyntaxError: unexpected character after line continuation character<\/pre><\/div>\n\n\n\n<p>Our code returns an error. This is because we have not enclosed our new line character in quotation marks.<br><\/p>\n\n\n\n<p>While the new line character is a special character, it must be enclosed within quotation marks whenever it is used. This is because Python treats \u201c\\\u201d as a line continuation character.<br><\/p>\n\n\n\n<p>To solve the error in our code, we need to enclose the newline character in <a href=\"https:\/\/careerkarma.com\/blog\/python-substring\/\">double quotes<\/a>:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>with open(&quot;shortbread_recipe.txt&quot;, &quot;w+&quot;) as ingredients_file:\n\t\tfor i in ingredients:\n\t\t\t ingredients_file.write(i + &quot;\\n&quot;)<\/pre><\/div>\n\n\n\n<p>Let\u2019s run our code. Our code returns no value to the console. A new file called \u201cshortbread_recipe.txt\u201d is created. Its contents are as follows:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>150g plain flour\n100g butter, chilled an cubed\n50g caster sugar<\/pre><\/div>\n\n\n\n<p>Our code has successfully printed our list to the \u201cshortbread_recipe.txt\u201d file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The \u201cSyntaxError: unexpected character after line continuation character\u201d error is raised when you add code after a line continuation character.<br><\/p>\n\n\n\n<p>To solve this error, make sure that you use the correct division operator (a forward slash) if you are performing mathematical operations. If you are using any special characters that contain a backslash, like the new line character, make sure that they are enclosed within quotation marks.<br><\/p>\n\n\n\n<p>Now you\u2019re ready to fix this error in your code!<\/p>\n","protected":false},"excerpt":{"rendered":"The Python line continuation character lets you continue a line of code on a new line in your program. The line continuation character cannot be followed by any value. If you specify a character or statement after a line continuation character, you encounter the \u201cSyntaxError: unexpected character after line continuation character\u201d error. In this guide,&hellip;","protected":false},"author":240,"featured_media":18042,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-21495","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Python","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":[]},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python SyntaxError: unexpected character after line | Career Karma<\/title>\n<meta name=\"description\" content=\"On Career Karma, learn about the Python SyntaxError: unexpected character after line continuation character, how the error works, and how to solve the error.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python SyntaxError: unexpected character after line continuation character Solution\" \/>\n<meta property=\"og:description\" content=\"On Career Karma, learn about the Python SyntaxError: unexpected character after line continuation character, how the error works, and how to solve the error.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-21T19:03:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:58:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/sean-lim-NPlv2pkYoUA-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Python SyntaxError: unexpected character after line continuation character Solution\",\"datePublished\":\"2020-08-21T19:03:17+00:00\",\"dateModified\":\"2023-12-01T11:58:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/\"},\"wordCount\":721,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/sean-lim-NPlv2pkYoUA-unsplash.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/\",\"name\":\"Python SyntaxError: unexpected character after line | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/sean-lim-NPlv2pkYoUA-unsplash.jpg\",\"datePublished\":\"2020-08-21T19:03:17+00:00\",\"dateModified\":\"2023-12-01T11:58:06+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"On Career Karma, learn about the Python SyntaxError: unexpected character after line continuation character, how the error works, and how to solve the error.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/sean-lim-NPlv2pkYoUA-unsplash.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/sean-lim-NPlv2pkYoUA-unsplash.jpg\",\"width\":1020,\"height\":680,\"caption\":\"black laptop displaying code on blue screen\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/careerkarma.com\/blog\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python SyntaxError: unexpected character after line continuation character Solution\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python SyntaxError: unexpected character after line | Career Karma","description":"On Career Karma, learn about the Python SyntaxError: unexpected character after line continuation character, how the error works, and how to solve the error.","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:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/","og_locale":"en_US","og_type":"article","og_title":"Python SyntaxError: unexpected character after line continuation character Solution","og_description":"On Career Karma, learn about the Python SyntaxError: unexpected character after line continuation character, how the error works, and how to solve the error.","og_url":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-08-21T19:03:17+00:00","article_modified_time":"2023-12-01T11:58:06+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/sean-lim-NPlv2pkYoUA-unsplash.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Python SyntaxError: unexpected character after line continuation character Solution","datePublished":"2020-08-21T19:03:17+00:00","dateModified":"2023-12-01T11:58:06+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/"},"wordCount":721,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/sean-lim-NPlv2pkYoUA-unsplash.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/","url":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/","name":"Python SyntaxError: unexpected character after line | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/sean-lim-NPlv2pkYoUA-unsplash.jpg","datePublished":"2020-08-21T19:03:17+00:00","dateModified":"2023-12-01T11:58:06+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"On Career Karma, learn about the Python SyntaxError: unexpected character after line continuation character, how the error works, and how to solve the error.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/sean-lim-NPlv2pkYoUA-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/sean-lim-NPlv2pkYoUA-unsplash.jpg","width":1020,"height":680,"caption":"black laptop displaying code on blue screen"},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-syntaxerror-unexpected-character-after-line-continuation-character\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/careerkarma.com\/blog\/python\/"},{"@type":"ListItem","position":3,"name":"Python SyntaxError: unexpected character after line continuation character Solution"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/21495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=21495"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/21495\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/18042"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=21495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=21495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=21495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}