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

Terry Jan Reedy tjreedy at udel.edu
Thu Apr 4 15:48:27 EDT 2013


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






More information about the Python-list mailing list