Home > In Python > Python Multiline Comment Syntax Error

Python Multiline Comment Syntax Error


Code: if ( a < 10 ): a = a + 1 """ Comment """ if ( someThing ): Error: 6 Error SyntaxError: unexpected indent where line is "if ( someThing They should describe what your code does and how to use it, but not for things like commenting out blocks of code. Second line. First Steps Towards Programming Previous topic 2. http://caribtechsxm.com/in-python/python-comment-syntax-error.php

Start fresh - When all else fails, you can start with a new empty file. hence are not ignored by the interpreter in the same way that #a comment is. Ok I tried using 3 pairs of quotes (which works as well) and I get this now: """ print("We are in a comment") print ("We are still in a comment") """ Anderson 3,59431531 add a comment| up vote 0 down vote Because the # convention is a common one, and there really isn't anything you can do with a multiline comment that

Which Of The Following Is Invalid Commenting Style In Python Mcq

the following causes a parser error.

I do prefer using # as regexp delimiter anyway so it won't hurt me ;-)


When they're not a docstring (first thing in a class/function/module), they are ignored. Lessons are pretty straight forward. I'm having an invalid syntax error in a comment before my script runs.

Hot Network Questions Counterintuitive polarizing filters What does the word "most" mean? excellent well organised and very clear web tutorial Pyn00b Dec. 24, 2013, 8:51 a.m. share|improve this answer answered Dec 29 '08 at 5:04 Jarred McCaffrey 64447 7 That's the issue, I believe: Using a string as a comment is not obvious and violates the Comments In Python 3 Consider the following example: apples = 0
pickedApples = input("Pick some apples: ")
apples = apples + pickedApples
pickedApples = input("Pick some more apples: ")
apples = apples + pickedApples

On the last line this is used again, demonstrating that the expressions on the right-hand side are all evaluated first before any of the assignments take place. doable sofare.. The print() function produces a more readable output, by omitting the enclosing quotes and by printing escaped and special characters: >>> '"Isn\'t," she said.' '"Isn\'t," she said.' >>> print('"Isn\'t," she http://stackoverflow.com/questions/7696924/way-to-create-multiline-comments Would it be ok to eat rice using spoon in front of Westerners?

with /* */

/* echo '';*/

?> up down -12 Anonymous ¶10 years ago M Spreij wrote, 08-May-2005 08:15...
A Python Comment Block This simple example is easy to fix, but in a more complicated program it can be difficult to find such problems. But then he said it was a SyntaxError, so I deleted my comment. And while I only remember a bit of my program at a time, I at least remember which part of my program I am looking at and so which I have

Which Of The Following Is Invalid Commenting Style In Python A) /* */ B) # C) ''' ''' D)

Remember to remove the extra closing parenthesis at the end of your file. The only way to do multi-line comments which are ignored by the parser is... Which Of The Following Is Invalid Commenting Style In Python Mcq The official Python docs say nothing on this, hence the question posted by OP. –Sanjay T. Multiline Comments In Python Sigh -.- –ADTC Jul 18 '15 at 5:26 @ADTC I agree and pylint agrees with you as well, it generates a warning "String statement has no effect (pointless-string-statement) –JamesD

Browse other questions tagged python comments multiline or ask your own question. http://caribtechsxm.com/in-python/python-try-catch-syntax-error.php Comment out - You can attempt to comment out a troublesome section of code to see if that is causing the problem. print(b) ... The triple-string is executed, but just doesn't return anything. Pycharm Block Comment

Even if it could be evaluated, the value would be assigned to score. Python only has one way of doing comments and that is using #. Sharma Feb 23 '15 at 20:40 Mmm, OK, but there is a PEP for it: python.org/dev/peps/pep-0257 –Fernando Gonzalez Sanchez Feb 24 '15 at 2:03 4 That's a PEP have a peek at these guys great tutorial.

It's clean, consistent, and handles nesting perfectly. –GatesDA Jun 15 '12 at 7:53 | show 9 more comments up vote 31 down vote Triple-quoted text should NOT be considered multi-line comments; Python Comment Line I like to use a decent editor that automatically deals with commenting out regions and wrapping multiline comments while I type. Zersiax July 21, 2015, 10:33 p.m.

Last updated on Sep 23, 2016.

Token Error: EOF in multi-line statement EOF stands for End Of File. As you learn to program, you will encounter various bugs or errors. Simple since now <3 Bob Evans May 28, 2014, 12:19 p.m. Python Block An Informal Introduction to Python 3.1.

In Python 3.4.3 shell has the syntax for multiple line comments changed? Thanks for the tutorial shenryuken Nov. 21, 2013, 12:42 a.m. do_a_different_thing() share|improve this answer answered Jun 29 at 13:04 Aya 19.7k42532 Then, you can use r'raw string' -- r'\xor' == '\\xor'. –GingerPlusPlus Jun 29 at 14:13 Well, check my blog How should I prepare myself for a more supervisory role?

They really need to update their backend testing system to use the latest builds so that NEW LEARNERS, who are likely using the latest build, will get consistent results and correct We will see more about numeric types later in the tutorial. At the interactive prompt, you have to type a tab or space(s) for each indented line. Close Join Quantopian Log In Close Need Help?

Note that I do NOT advocate the approach for commenting out code - although that is often handy when trying alternate approaches, as long as the well known possible side effects What stops messenger RNA from binding to itself? Token Error (missing parenthesis Token errors in Python will pop up a dialog box like the one below. To avoid this and get 9, you can use (-3)**2. [2]Unlike other languages, special characters such as \n have the same meaning with both single ('...') and

If this doesn't work, you may have to scan your entire file to look for the problem. share|improve this answer answered Dec 29 '08 at 15:17 recursive 49.1k1694184 add a comment| up vote 2 down vote I solved this by downloading a macro for my text editor (TextPad) In Python, like in C, any non-zero integer value is true; zero is false. Why does a full moon seem uniformly bright from earth, shouldn't it be dimmer at the "border"?

see more linked questions… Related 360What is the best comment in source code you have ever encountered?3838Can comments be used in JSON?195Why doesn't Python have multiline comments?68Multiline Comment Workarounds?491What's a quick