Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42773 > unrolled thread

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

Started bySatabdi Mukherjee <satamukh@gmail.com>
First post2013-04-04 12:08 -0700
Last post2013-04-04 15:48 -0400
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee <satamukh@gmail.com> - 2013-04-04 12:08 -0700
    Re: problem in running a basic code in python 3.3.0 that includes HTML file Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-04 15:48 -0400

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

FromSatabdi Mukherjee <satamukh@gmail.com>
Date2013-04-04 12:08 -0700
Subjectproblem in running a basic code in python 3.3.0 that includes HTML file
Message-ID<4b7526eb-b501-4ff8-a257-8cfefbeda413@googlegroups.com>
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

[toc] | [next] | [standalone]


#42775

FromTerry Jan Reedy <tjreedy@udel.edu>
Date2013-04-04 15:48 -0400
Message-ID<mailman.113.1365104927.3114.python-list@python.org>
In reply to#42773
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


[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web