Jump to content

What is this doing?

- - - - -

  • Please log in to reply
5 replies to this topic

#1
NinjaTool

NinjaTool

    Newbie

  • Members
  • PipPip
  • 11 posts
When I type this in IDLE, it just goes in a loop. Whats happening here? I'm using Python 3.1.3 on Win7.

 


print '''Content - type: text/html




#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
I do not know anything about Python, although when I run it I get this:
[FONT=Courier New]  File "prog.py", line 2     
print '''Content - type: text/html                                      
                                  ^ SyntaxError: EOF while scanning triple-quoted string literal[/FONT]
The IDE you are using likely has trouble parsing that statement and returning its error.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
ZekeDragon

ZekeDragon

    Writes binary right handed and hex left handed

  • Moderators
  • 2,103 posts
@Alexander: IDLE is not an IDE, it's a GUI for the Python REPL.

@OP: The reason IDLE is just looping is you never complete the triple-quote string, which is by it's nature a multi-line string. You have to close it:
print('''Content - type: text/html

You can have more content here.

And then end it with 3 quotes.''')
Remember that in Python 3 (what you're using), print is no longer a keyword and is now a function.

Edited by ZekeDragon, 19 May 2011 - 08:32 PM.

Wow I changed my sig!

#4
NinjaTool

NinjaTool

    Newbie

  • Members
  • PipPip
  • 11 posts
I see. Thanx everyone.

#5
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
IDLE is an IDE.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#6
ZekeDragon

ZekeDragon

    Writes binary right handed and hex left handed

  • Moderators
  • 2,103 posts

Alexander said:

IDLE is an IDE.
Tells you how long I've been out of Python, or perhaps merely how little I used IDLE. I retract my statement. :)
Wow I changed my sig!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users