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

  • Thread starter Satabdi Mukherjee
  • Start date
S

Satabdi Mukherjee

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
 
T

Terry Jan Reedy

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.

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top