syntax - python: writing HTML in python function. syntaxError: expected an intended block -


i trying generate html checkbox within python function. code

import html  def createevent(str): "this prints passed string function"    print str;    return;  createevent (''' content-type: text/html    <html>   <head>   <title> list of possible events can notified our system </title>   </head>   <body>  <form> <input type="checkbox" name="tsunami" value="tsunami">tsunami<br> <input type="checkbox" name="earthquake" value="earthquake">earthquake<br> <input type="checkbox" name="volcano" value="volcano">volcano<br> <input type="checkbox" name="hurricane" value="hurricane">hurricane<br> <input type="checkbox" name="sinkholes" value="sinkholes">sinkholes<br> <input type="checkbox" name="tornado" value="tornado">tornado<br> <input type="checkbox" name="landslide" value="landslide">landslide<br> <input type="checkbox" name="downburst" value="downburst">downburst<br> </form>  <input type="submit" value="submit"> </body> </html> ''') 

but when try compile , giving syntax error: expected intended block. please let me know how solve problem.

you have no indentation in comments.

note: comment """ , not "

import html  def createevent(str):     """this prints passed string function"""     #^ indentation space needed here - docstrings represented """ , not "     print str     #good practice have 4 spaces indentation.     return     #     ^ no need of ; 

a idea install pep8 python library ,

pep8 <filename>.py 

and fix issues, if any


Comments