Re: Python windows interactive.



notejam wrote:

Can not figure out how to write more than one line in interpreter mode.

press return between the lines. if you get a "..." prompt, keep adding
more lines to the current statement. press return an extra time to end the multiline-statement.

Is that all interpreter is good for, testing one liners? I have it
run the program everytime I hit return

no, it executes the *current statement* when you press return. a program consists usually consists of many statements.

and can not figure out how to enter multiple lines of code.

if you'd entered a statement that actually consisted of multiple lines, you'd noticed (try entering an "if"-statement, for example).

I am jsut wondering can a program with 2 or more lines
be wrote from the interpreter mode?

Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> def gettitle(url):
.... f = urllib.urlopen(url)
.... s = f.read()
.... i = s.find("<title>")
.... j = s.find("</title>", i)
.... return s[i+7:j]
....
>>> gettitle("http://www.python.org";)
'Python Programming Language -- Official Website'
>>> gettitle("http://www.cnn.com";)
'CNN.com - Breaking News, U.S., World, Weather, Entertainment &amp; Video News'
>>> sites = ["http://news.bbc.co.uk";, "http://reddit.com";,
.... "http://www.fbi.gov";
.... ]
>>> for site in sites:
.... print gettitle(site)
....
BBC NEWS | News Front Page
reddit.com: what&#39;s new online
Federal Bureau of Investigation - Home Page
>>>

etc.

</F>

.



Relevant Pages

  • Re: Our new horse
    ... just about everything's cheaper here. ... The bad news, "everything" consists of two corn cobs and a length of baling twine. ... North Illinois CANTER works out of Arlington and Hawthorne, near Chicago, but they're a six-hour trip one-way. ...
    (rec.equestrian)
  • Re: Our new horse
    ... The good news, ... "everything" consists of two corn cobs and a length of baling twine. ...
    (rec.equestrian)
  • Programatically add news
    ... I have an application written in c# which consists of a form. ... that when i submit that form the content appear as news on the news ... web part of the sharepoint portal server 2003. ... Sarika ...
    (microsoft.public.sharepoint.portalserver)
  • Adding news programatically
    ... I have an application written in c# which consists of a form. ... that when i submit that form the content appear as news on the news ... web part of the sharepoint portal server 2003. ... Sarika ...
    (microsoft.public.sharepoint.teamservices.caml)
  • Re: S^n is simply connected, n>=2
    ... maps) can be homotoped to one that doesn't hit all the points of S^2. ... Note that q consists of finitely many line segments (projected ... intersection of such sets is nonempty, ...
    (sci.math)