python: writing HTML in python function. syntaxError: expected an intended block
Question: i am trying to generate a html checkbox within a python function. this is my
code

    
    
    import HTML 
    def CreateEvent(str):
    "This prints a passed string into this function"
       print str;
       return;
    
    CreateEvent ('''
    content-type: text/html 
    
     <html> 
     <head> 
     <title> the list of all possible events that can be notified by 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 i try to compile it , it is giving the syntax error: expected an
intended block. please let me know how to solve this problem.


Answer: You have no indentation in the comments.

Note: The comment is `"""` and not `"`

    
    
    import HTML 
    def CreateEvent(str):
        """This prints a passed string into this function"""
        #^ Indentation space needed here - Also docstrings are represented with """ and not "
        print str
        #Good practice to have 4 spaces as indentation.
        return
        #     ^ No need of ;
    

A good idea would be to install the `pep8` python library and do a

    
    
    pep8 <filename>.py
    

and fix the issues, if any

