[Solved] Is it possible to put a comment at the beginning of a line in python?


No, you cannot have exactly that. However, if there some reason why you really need to have a string at the beginning of a line (and note that this not a recommended style at all in Python), you can write:

''' This line is imperative: '''; x = 5

Note the ; after the string. This works because ''' This line is imperative: ''' and x = 5 are effectively two statements that can be concatenated in one line in Python with a semicolon.

2

solved Is it possible to put a comment at the beginning of a line in python?