Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > problem in running a basic code in python 3.3.0 that includes HTML file

Reply
Thread Tools

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

 
 
Satabdi Mukherjee
Guest
Posts: n/a
 
      04-04-2013
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
 
Reply With Quote
 
 
 
 
Terry Jan Reedy
Guest
Posts: n/a
 
      04-04-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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML file server side includes plus forms authentication William F. Zachmann ASP .Net 6 10-25-2005 01:16 AM
Re: Python interpreter in Basic or a Python-2-Basic translator. rrr@ronadam.com Python 0 05-02-2005 01:48 PM
Python interpreter in Basic or a Python-2-Basic translator. Engineer Python 6 05-01-2005 10:16 PM
problem: writing out an XML file always includes the commented DTD in the beginning. Why? bronski Java 0 02-16-2005 11:43 AM
Downloading File Includes HTML ??? =?Utf-8?B?am9obno=?= ASP .Net 1 02-27-2004 01:50 AM



Advertisments