problem in running a basic code in python 3.3.0 that includes HTML file

Discussion in 'Python' started by Satabdi Mukherjee, Apr 4, 2013.

  1. i have written this code and i need to run this file

    def CreateEvent(str):
    "This prints a passed string into this function";
    print str;
    return;

    CreateEvent (print'''
    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 it gives this error

    expected an intended block.

    can anyone please tell me how to overcome this problem? i am working in python 3.3.0
    thank you
     
    Satabdi Mukherjee, Apr 4, 2013
    #1
    1. Advertising

  2. Re: problem in running a basic code in python 3.3.0 that includesHTML file

    On 4/4/2013 3:08 PM, Satabdi Mukherjee wrote:
    > i have written this code and i need to run this file
    >
    > def CreateEvent(str):


    Using the builtin name 'str' as a parameter name is a bad idea.
    Use 's' or 'string' or something instead.

    > "This prints a passed string into this function";


    The line above has to be indented. Leave off the trailing ';'

    > print str;


    This is not valid in Python 3, where print() is a function
    This line would have to be 'print(s)'. However, the function as written
    is senseless; just call print() directly.

    > return;


    And empty return at the end does nothing. There is already an implicit
    'return None' at the end of every function.

    > CreateEvent (print'''


    delete 'print' -- it is another syntax error.

    > 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>
    > ''')


    --
    Terry Jan Reedy
     
    Terry Jan Reedy, Apr 4, 2013
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?am9obno=?=

    Downloading File Includes HTML ???

    =?Utf-8?B?am9obno=?=, Feb 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    597
    bruce barker
    Feb 27, 2004
  2. Michael Schwarz
    Replies:
    0
    Views:
    150
    Michael Schwarz
    Oct 2, 2013
  3. Gisle Vanem
    Replies:
    0
    Views:
    153
    Gisle Vanem
    Oct 2, 2013
  4. Stefan Behnel
    Replies:
    0
    Views:
    142
    Stefan Behnel
    Oct 2, 2013
  5. Oscar Benjamin
    Replies:
    0
    Views:
    122
    Oscar Benjamin
    Oct 3, 2013
Loading...

Share This Page