Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-26 Thread Alan Gauld
On 26/06/12 02:22, Steven D'Aprano wrote: I think you've messed up your quoting. It was Mike Nickey, not Emile, who suggested using w[0] == 'x'. Yes, but Emile's comment was in context of Mike's assertion about w[0]. However, reading it back I think that the This in Emile's comment was

[Tutor] Looping over histogram plots

2012-06-26 Thread Elaina Ann Hyde
Hello all, I have been making some big multiplots lately and found a nice little way of writing out 30 plots as follows, this part works great and leads up to my question, here I have 30 sets defined by the set=(), in this case I get a nice arrangement of 30 plots for V(GSR) and Log(g) (2

Re: [Tutor] Looping over histogram plots

2012-06-26 Thread Don Jennings
Message: 1 Date: Tue, 26 Jun 2012 18:40:50 +1000 From: Elaina Ann Hyde elainah...@gmail.com To: tutor@python.org Subject: [Tutor] Looping over histogram plots snip set=(dat['a'+str(index)] == 1.00) You should not override the builtin set() type [1] as you've done here by assigning

[Tutor] Barcode decoder in Python

2012-06-26 Thread Sithembewena Lloyd Dube
Hi everyone, Is there any decent barcode decoder software which one could use to read image barcodes and return a result to a calling function/ app? I wish to implement a Python server backend which would import and use such a module (if it were that, for instance). Thanks. -- Regards,

[Tutor] Generating random alphanumeric codes

2012-06-26 Thread Sithembewena Lloyd Dube
HI, Would anyone have tips on how to generate random 4-digit alphanumeric codes in python? Also, how does one calculate the number of possible combinations? Thanks in advance. -- Regards, Sithembewena Lloyd Dube ___ Tutor maillist -

Re: [Tutor] Generating random alphanumeric codes

2012-06-26 Thread Hugo Arts
On Tue, Jun 26, 2012 at 4:52 PM, Sithembewena Lloyd Dube zebr...@gmail.comwrote: HI, Would anyone have tips on how to generate random 4-digit alphanumeric codes in python? Also, how does one calculate the number of possible combinations? Thanks in advance. Python's, random module is your

Re: [Tutor] Generating random alphanumeric codes

2012-06-26 Thread taserian
First of all, determine your alphabet (the pool of characters you'll derive your 4-character code from): - For example, using an English alphabet with both lowercase and uppercase letters and digits 0-9 makes for 62 characters (26 + 26 + 10). Then, ask if you want to allow a character to repeat

Re: [Tutor] Generating random alphanumeric codes

2012-06-26 Thread taserian
Correcting what was said below. - If not, then it's a little more complicated, calculate (length) * (length-1) * (length-2) * (length-3), or in other words the factorial of length divided by the factorial of (length - 4). In my example, 62! / (62-4)! = 13,388,280 On Tue, Jun 26, 2012 at 11:08

Re: [Tutor] Tutor Digest, Vol 100, Issue 58

2012-06-26 Thread Emile van Sebille
On 6/26/2012 1:10 AM Alan Gauld said... On 26/06/12 02:22, Steven D'Aprano wrote: I think you've messed up your quoting. It was Mike Nickey, not Emile, who suggested using w[0] == 'x'. Yes, but Emile's comment was in context of Mike's assertion about w[0]. However, reading it back I think

Re: [Tutor] Generating random alphanumeric codes

2012-06-26 Thread Martin A. Brown
Hello, : Would anyone have tips on how to generate random 4-digit : alphanumeric codes in python? Also, how does one calculate the : number of possible combinations? Here are some thoughts that come to my mind: import string import random # -- technique #1, using random.choice

Re: [Tutor] Generating random alphanumeric codes

2012-06-26 Thread Dave Angel
On 06/26/2012 03:47 PM, Martin A. Brown wrote: Hello, : Would anyone have tips on how to generate random 4-digit : alphanumeric codes in python? Also, how does one calculate the : number of possible combinations? Here are some thoughts that come to my mind: import string import

[Tutor] Re.findall question

2012-06-26 Thread Alexander Quest
I'm a bit confused about extracting data using re.search or re.findall. Say I have the following code: tuples = re.findall(r'blahblah(\d+)yattayattayatta(\w+)moreblahblahblah(\w+)over', text) So I'm looking for that string in 'text', and I intend to extract the parts which have parentheses

Re: [Tutor] Re.findall question

2012-06-26 Thread Alan Gauld
On 26/06/12 23:30, Alexander Quest wrote: My question is how does Python know to return just the part in the parentheses and not to return the blahblah and the yattayattayatta, etc...? If you want to know *how* Python does it you will have to read the module code (probably in C so download

Re: [Tutor] Looping over histogram plots

2012-06-26 Thread Elaina Ann Hyde
Dear Don, Thanks for the comment, the set type is no problem for me, this is just a variable that I call set... and it works great for my purposes, I do suspect it is something in the way that matplotlib/pyplot deals with histograms, but I have not so far been able to find the right syntax.

Re: [Tutor] Looping over histogram plots

2012-06-26 Thread Elaina Ann Hyde
Yay Python: The solution was a syntax one, if anyone else ever feels like massively multi-plotting histograms, here is the working code: #-- fig, axes = plt.subplots(nrows=5, ncols=6, figsize=(12,6)) index=0 for b in axes: for ax in b: