[Tutor] StringIO and dictionaries

2007-04-30 Thread Necmettin Begiter
I want to run an external python script inside my script. So here is what I came up with: Print codename for testing purposes. Define an empty dictionary. Read the file. Do StringIO assignments and run the code. Get the outputs and append them to the dictionary. Print the outputs for testing purp

[Tutor] iterating

2007-04-30 Thread Cecilia Alm
1) Unordered maps/collections like sets and dictionaries also seem to support iterating over set members or dictionary keys with "for x in y" syntax. As far as I can tell, the following three ways generally behave the same way, or is there a difference in behavior between: a) for key in dictionary

[Tutor] Problem with "Hello, World"

2007-04-30 Thread Alexander Dering
So I've written my first python program (the ubiquitous 'Hello, World'). Already, I'm having problems. First, the question I can't find the answer to. Where (exactly) am I supposed to save my files? When I wrote "hello.py" there was no clearly stated "Make sure you save it HERE or else Python wo

Re: [Tutor] Problem with "Hello, World"

2007-04-30 Thread Rikard Bosnjakovic
On 4/28/07, Alexander Dering <[EMAIL PROTECTED]> wrote: > But I can't get it to run directly from Python. If I go to the terminal and > type "python hello.py" (which is what the instructions say I should be > doing!) I get the following: > > >>> hello.py > Traceback (most recent call last): >

Re: [Tutor] iterating

2007-04-30 Thread Kent Johnson
Cecilia Alm wrote: > 1) Unordered maps/collections like sets and dictionaries also seem to > support iterating over set members or dictionary keys with "for x in > y" syntax. As far as I can tell, the following three ways generally > behave the same way, or is there a difference in behavior between

[Tutor] Fwd: iterating

2007-04-30 Thread Cecilia Alm
2007/4/30, Kent Johnson <[EMAIL PROTECTED]>: . Also if you are adding or deleting from the dict > during the iteration then dict.keys() is safer because the list of keys > is created before the add and delete. Thanks for the response; by adding and deleting, I assume you refer to adding or deletin

Re: [Tutor] StringIO and dictionaries

2007-04-30 Thread Bob Gailer
Necmettin Begiter wrote: > I want to run an external python script inside my script. So here is what I > came up with: > > Print codename for testing purposes. > Define an empty dictionary. > Read the file. > Do StringIO assignments and run the code. > Get the outputs and append them to the dictio

Re: [Tutor] Fwd: iterating

2007-04-30 Thread Kent Johnson
Cecilia Alm wrote: > 2007/4/30, Kent Johnson <[EMAIL PROTECTED]>: > . Also if you are adding or deleting from the dict >> during the iteration then dict.keys() is safer because the list of keys >> is created before the add and delete. > > Thanks for the response; by adding and deleting, I assume y

[Tutor] best way to tell if i am connected to the internet

2007-04-30 Thread shawn bright
hello there all, i am wondering, what would be the simplest way to get a true/false am i connected to the internet ? right now i am using httplib to fetch a webpage every 20 minutes to see, but i am thinking that there is a better way, any suggestions would be encouraging thanks shawn

Re: [Tutor] best way to tell if i am connected to the internet

2007-04-30 Thread Jalil
ping a host on the net if you get an echo response back you are good. better yet ping the host page you are scraping. On 4/30/07, shawn bright <[EMAIL PROTECTED]> wrote: hello there all, i am wondering, what would be the simplest way to get a true/false am i connected to the internet ? righ

Re: [Tutor] best way to tell if i am connected to the internet

2007-04-30 Thread shawn bright
ok, cool. thanks sk On 4/30/07, Jalil <[EMAIL PROTECTED]> wrote: ping a host on the net if you get an echo response back you are good. better yet ping the host page you are scraping. On 4/30/07, shawn bright < [EMAIL PROTECTED]> wrote: > > hello there all, > > i am wondering, what would be t