[Tutor] urllib2 issue getting realm

2011-08-31 Thread Johan Geldenhuys
Hi everybody, I am trying to use a very simple piece of code to get the realm from different HTTPS URLs. This realm is essential for successful authentication on the HTTPS session. If have to run this for a few different hosts and capture the realm. For one host, it works perfectly, but when I t

Re: [Tutor] urllib2 issue getting realm

2011-08-31 Thread Sander Sweers
On 31 August 2011 09:46, Johan Geldenhuys wrote: > I am trying to use a very simple piece of code to get the realm from > different HTTPS URLs. > > This realm is essential for successful authentication on the HTTPS session. I think you got 2 things mixed up, http authentication and encrypted http

Re: [Tutor] urllib2 issue getting realm

2011-08-31 Thread Steven D'Aprano
Johan Geldenhuys wrote: Hi everybody, I am trying to use a very simple piece of code to get the realm from different HTTPS URLs. This realm is essential for successful authentication on the HTTPS session. What happens if you paste https://192.168.10.191/axis-cgi/jpg/image.cgi?resolution=1280

Re: [Tutor] urllib2 issue getting realm

2011-08-31 Thread Johan Geldenhuys
Focusing on the code below, do you know why it would raise the exception for the first IP and not for the second? Thank you Johan Sent from my iPhone 4 On 31/08/2011, at 22:09, Sander Sweers wrote: > On 31 August 2011 09:46, Johan Geldenhuys wrote: >> I am trying to use a very simple piece of

Re: [Tutor] urllib2 issue getting realm

2011-08-31 Thread Sander Sweers
On 31 August 2011 14:27, Johan Geldenhuys wrote: > On 31/08/2011, at 22:09, Sander Sweers wrote: >> On 31 August 2011 09:46, Johan Geldenhuys wrote: >>> I am trying to use a very simple piece of code to get the realm from >>> different HTTPS URLs. >>> >>> This realm is essential for successful a

[Tutor] Getting values from different functions (def's)

2011-08-31 Thread Susana Iraiis Delgado Rodriguez
Hello list !! I'm developing a Python GUI application. I alreday developed a very simple window with buttons, each button will do a different task, but the most important button will need to get information gotten in previous python's functions. Let's say I have four functions but at the end I want

Re: [Tutor] Getting values from different functions (def's)

2011-08-31 Thread Alan Gauld
On 31/08/11 18:17, Susana Iraiis Delgado Rodriguez wrote: Hello list !! I'm developing a Python GUI application. I alreday developed a very simple window with buttons, each button will do a different task, but the most important button will need to get information gotten in previous python's func

[Tutor] Quote of the Day version 1.0

2011-08-31 Thread Cranky Frankie
I made some headway on the quote of the day program. I just tried to do it simple using two assumptions: - long quotes are going to print funny until I figure out the string splitting stuff - hard coding the quotes and authors in the program is simple, and I can use a spreadsheet to generate the s

Re: [Tutor] Quote of the Day version 1.0

2011-08-31 Thread Prasad, Ramit
-Original Message- I made some headway on the quote of the day program. I just tried to do it simple using two assumptions: - long quotes are going to print funny until I figure out the string splitting stuff - hard coding the quotes and authors in the program is simple, and I can use a sp

[Tutor] meaning of % in: if n % x == 0:

2011-08-31 Thread Lisi
?? If either n or x or both were 0, and % were the same thing as *, the statement would be true, but from the context I don't think that % does mean the same as *, because * appears very soon after in the same fragment of code. Lisi I'm sorry I am making such heavy weather of all this. Blam

Re: [Tutor] meaning of % in: if n % x == 0:

2011-08-31 Thread Hugo Arts
On Wed, Aug 31, 2011 at 9:35 PM, Lisi wrote: > ??  If either n or x or both were 0, and % were the same thing as *, the > statement would be true, but from the context I don't think that % does mean > the same as *, because * appears very soon after in the same fragment of > code. > > Lisi > > I'm

Re: [Tutor] meaning of % in: if n % x == 0:

2011-08-31 Thread Joel Goldstick
On Wed, Aug 31, 2011 at 3:58 PM, Hugo Arts wrote: > On Wed, Aug 31, 2011 at 9:35 PM, Lisi wrote: > > ?? If either n or x or both were 0, and % were the same thing as *, the > > statement would be true, but from the context I don't think that % does > mean > > the same as *, because * appears ve

Re: [Tutor] urllib2 issue getting realm

2011-08-31 Thread Johan Geldenhuys
Thanks Sanders Will give that a go Johan Sent from my iPhone 4 On 31/08/2011, at 23:03, Sander Sweers wrote: > On 31 August 2011 14:27, Johan Geldenhuys wrote: >> On 31/08/2011, at 22:09, Sander Sweers wrote: >>> On 31 August 2011 09:46, Johan Geldenhuys wrote: I am trying to use a very

Re: [Tutor] Quote of the Day version 1.0

2011-08-31 Thread Sander Sweers
On 31 August 2011 21:14, Cranky Frankie wrote: > I made some headway on the quote of the day program. I just tried to > do it simple using two assumptions: > > - long quotes are going to print funny until I figure out the string > splitting stuff Define funny? Normally the linux console will wrap

Re: [Tutor] Quote of the Day version 1.0

2011-08-31 Thread Prasad, Ramit
[snip] > Do not hesitate to ask questions as I added tuple unpacking and string >formatting which you might not have covered in depth yet in your >tutorial. [snip] >author, quote = random.choice(quotes) >print "%s\n\tBy %s" % (quote, author) I figured I might as well add my preferred method of

[Tutor] reclassify values in an array

2011-08-31 Thread questions anon
Dear All, I have been going round in circles trying to solve something that sounds simple. I have a huge array and I would like to reclassify the values. Firstly just make them zeros and ones, for example if the values in the array are less than 100 make them 0 and if greater than 100 make them 1.

Re: [Tutor] Quote of the Day version 1.0

2011-08-31 Thread Alan Gauld
On 31/08/11 20:14, Cranky Frankie wrote: This code works. Now I just have to figure out: - how to associate .py files in Ubuntu to IDLE You probably don't want to do that. IDLE is fine for developing code but you don't want to run it in IDLE for general use you want to use the interpreter.

Re: [Tutor] meaning of % in: if n % x == 0:

2011-08-31 Thread Alan Gauld
On 31/08/11 20:35, Lisi wrote: ?? If either n or x or both were 0, and % were the same thing as *, the statement would be true, but from the context I don't think that % does mean the same as *, because * appears very soon after in the same fragment of code. It's the remainder operator: IF N

Re: [Tutor] reclassify values in an array

2011-08-31 Thread Alan Gauld
On 01/09/11 00:17, questions anon wrote: Dear All, I have been going round in circles trying to solve something that sounds simple. I have a huge array and I would like to reclassify the values. Firstly just make them zeros and ones,... And then finally sum them together. And what has been the

Re: [Tutor] meaning of % in: if n % x == 0:

2011-08-31 Thread Steven D'Aprano
Hugo Arts wrote: n % y == 0 if n is divisible by y. This is useful in factoring prime numbers If you find a way to factor *prime numbers*, you're doing something wrong. :) (By definition, a prime number has no factors apart from itself and one, which are trivial.) You mean, factorising n

Re: [Tutor] meaning of % in: if n % x == 0:

2011-08-31 Thread bob gailer
% is not remainder - it is modulo. Difference shows up when left agument is negative. -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listi

Re: [Tutor] meaning of % in: if n % x == 0:

2011-08-31 Thread Hugo Arts
ah, my mistake. I was in a hurry writing that post, which is a really bad idea :/ On Thu, Sep 1, 2011 at 2:09 AM, Steven D'Aprano wrote: > Hugo Arts wrote: > >>  n % y == 0 if n is divisible by y. This is useful in factoring prime >> numbers > > If you find a way to factor *prime numbers*, you're

Re: [Tutor] reclassify values in an array

2011-08-31 Thread Andre' Walker-Loud
Hi anonymous questioner, Like Alan, I suspect you are using numpy as import numpy as N there is probably a numpy email list where this would be more appropriate (personally I don't object, but I don't want to speak for all the subscribers). the 2nd attempt is closer to the right answer. To he