Re: [Tutor] Splitting a string into n-sized bytes

2006-03-14 Thread Steve Nelson
On 3/14/06, Adam <[EMAIL PROTECTED]> wrote: > Hopefully that should point you in the right direction to do n-sized > words as well. Indeed - as I now have a function: def nsplit(s, n): return [s[i:i+n] for i in range(0, len(s), n)] Incidentally I am currently going with: def nsplit(s, n):

[Tutor] OSError

2006-03-14 Thread Christopher Spears
I am trying to write a function that takes a directory name and describes the contents of the directory (file name and size) recursively. Here is what I have written so far: import os, os.path def describeDirectory(directory): if os.listdir(directory) == []: print "Empty directory!"

Re: [Tutor] scaling values

2006-03-14 Thread kevin parks
Thanks to Kent Johnson, & David Heiser and everyone else. Looks like i was most of the way there...hehe... David Heiser gets special bonus points for actually understanding my initial mysterious query. ___ Tutor maillist - Tutor@python.org http://mai

[Tutor] Help me please

2006-03-14 Thread yogeshwarran Nadeson
Hello, I am a newbie in python programming without previous programming experience.Here i would like to ask a question based on the exercises given by Josh Cogliatti in his tutorial.I'll paste the question.Hope you can help me to solve it.I'd like to end it by saying thanks for all yourr help. :Mod

Re: [Tutor] Splitting a string into n-sized bytes

2006-03-14 Thread Smith
| From: "Steve Nelson" | | Further to my previous puzzling, I've been working out the best way to | chop a string up into n-sized words: | I think the follow use of groupby is from Raymond Hettinger from ASPN recipes. The batch() function will return an iterable to you in user-definable sized

Re: [Tutor] [Fwd: Re: Indoor ultimate]

2006-03-14 Thread John Fouhy
On 15/03/06, Sam B <[EMAIL PROTECTED]> wrote: > I'm keen! > > what shoe type do you reccomend? Non-marking cross trainers will do. If you want to spend more money, go into shoe clinic and tell them you want shoes for playing indoor ultimate. I ended up with a pair of Adidas handball shoes. Expe

Re: [Tutor] [Fwd: Re: Indoor ultimate]

2006-03-14 Thread John Fouhy
Sorry guys, total brain fart there :-) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Tix: binding

2006-03-14 Thread hk
I am looking at Tix and I am stuck with what seems to be a simple problem: I want to bind the cancel buttom of a ExFileSelectBox to a routine in my class, but can not make it work. I guess the problem is the same for any binding of tix sub-widgets, so if someone could send some sample code. >>>

Re: [Tutor] scaling values

2006-03-14 Thread Kent Johnson
kevin parks wrote: > hi, > > Seems my post added much confusion. Sorry... I was hoping not to have > to post my code since it is really wrong and slightly embarrassing.. I think the confusion was about what input range to use. From your code it looks like you want to use just the actual range

Re: [Tutor] Splitting a string into n-sized bytes

2006-03-14 Thread Adam
On 14/03/06, Steve Nelson <[EMAIL PROTECTED]> wrote: > Hello all, > > Further to my previous puzzling, I've been working out the best way to > chop a string up into n-sized words: > > I'm aware that I can use a slice of the string, with, eg, myWord[0:4]. > > I am also aware that I can do blob = myW

[Tutor] Splitting a string into n-sized bytes

2006-03-14 Thread Steve Nelson
Hello all, Further to my previous puzzling, I've been working out the best way to chop a string up into n-sized words: I'm aware that I can use a slice of the string, with, eg, myWord[0:4]. I am also aware that I can do blob = myWord.pop(0) to take (and remove) the first character. I can botch

Re: [Tutor] scaling values

2006-03-14 Thread kevin parks
hi, Seems my post added much confusion. Sorry... I was hoping not to have to post my code since it is really wrong and slightly embarrassing.. what i am trying to do is map an input range of values to output range. I was hoping to make it a bit of an all purpose utility that would map pretty m

Re: [Tutor] Iterate over letters in a word

2006-03-14 Thread Adam
On 14/03/06, Adam <[EMAIL PROTECTED]> wrote: > Here's something you might find useful they've just started a series > on cryptography on this site, you can read them or listen to a > podcast. > D'oh! Would help if I actually stuck the link in http://www.grc.com/SecurityNow.htm#30 __

Re: [Tutor] Iterate over letters in a word

2006-03-14 Thread Adam
Here's something you might find useful they've just started a series on cryptography on this site, you can read them or listen to a podcast. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Iterate over letters in a word

2006-03-14 Thread Danny Yoo
> Yes - at the moment this is just a way for me to begin to get my head > around how cryptography works from anabsolutely ludicrously basic > position. This all started because I couldn't get my head around the > difference between an encryption algorithm and the key. I thought that > by writing

Re: [Tutor] Iterate over letters in a word

2006-03-14 Thread Danny Yoo
> As a side note, remember that that xor-ing a key with a message is > trivial to break (it's just a variation on the Vigenere cipher first > published in 1568). So don't use if for any real applications. Hi Matthew, Counterpoint: think of "one-time pads". http://en.wikipedia.org/wiki/One-

Re: [Tutor] Iterate over letters in a word

2006-03-14 Thread Steve Nelson
On 3/14/06, Steve Nelson <[EMAIL PROTECTED]> wrote: > On 3/14/06, Danny Yoo <[EMAIL PROTECTED]> wrote: > > > The idea is to unpack four single characters as a single 4-byte integer. > > That's really useful, thanks, as I was planning to iterate over each > letter and call ord() Ok, so experimentin

Re: [Tutor] Iterate over letters in a word

2006-03-14 Thread Steve Nelson
On 3/14/06, Matthew Webber <[EMAIL PROTECTED]> wrote: > As a side note, remember that that xor-ing a key with a message is trivial > to break (it's just a variation on the Vigenere cipher first published in > 1568). So don't use if for any real applications. Yes - at the moment this is just a way

Re: [Tutor] Iterate over letters in a word

2006-03-14 Thread Matthew Webber
As a side note, remember that that xor-ing a key with a message is trivial to break (it's just a variation on the Vigenere cipher first published in 1568). So don't use if for any real applications. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Nel

Re: [Tutor] Iterate over letters in a word

2006-03-14 Thread Steve Nelson
On 3/14/06, Danny Yoo <[EMAIL PROTECTED]> wrote: > The idea is to unpack four single characters as a single 4-byte integer. That's really useful, thanks, as I was planning to iterate over each letter and call ord() > This kind of transformation is reversable: Highly useful. Thanks very much in

Re: [Tutor] Iterate over letters in a word

2006-03-14 Thread Danny Yoo
> "Hello Tutors!" could be split into: > > "Hell" "o Tut" "ors!" > > and xor'd with "beer" > > I think I understand how xor works (thanks to an earlier post) but I'm > not sure how to iterate over each letter in a string. What is the > recommended way to do this? The xor bitwise operator works wi

Re: [Tutor] scaling values

2006-03-14 Thread Hugo González Monteverde
Hi Kevin, Do you mean:? 1)take the highest value in the list hval, take the lowest value in the list lval 2) pass top and bottom NEW values for the list: ntop nbot 3) then build another list where hval is replaced by ntop, lval is replaced by nbot, and everything else is geometrically scaled

Re: [Tutor] Using Beautiful Soup to extract tag names

2006-03-14 Thread Kent Johnson
Ed Singleton wrote: > As always Kent, you're amazing. Thank you! > > That will do perfectly. (Though the ElementTree documentation seems a > bit difficult to get through. I'm sure I'll get through it > eventually). Unfortunately I have to agree with you on this one. ET is going to be part of

Re: [Tutor] Using Beautiful Soup to extract tag names

2006-03-14 Thread Ed Singleton
As always Kent, you're amazing. That will do perfectly. (Though the ElementTree documentation seems a bit difficult to get through. I'm sure I'll get through it eventually). Thanks Ed On 14/03/06, Kent Johnson <[EMAIL PROTECTED]> wrote: > Ed Singleton wrote: > > I have (unfortunately) receive

Re: [Tutor] scaling values

2006-03-14 Thread David Heiser
Is this what you're asking for? # Scaler.py # def scale(OldList, NewMin, NewMax): NewRange = float(NewMax - NewMin) OldMin = min(x) OldMax = max(x) OldRange = float(OldMax - OldMin) ScaleFactor = NewRange / OldRange print '\nEquasion: NewValue = ((OldValue - ' + str(Old

Re: [Tutor] scaling values

2006-03-14 Thread Bob Gailer
kevin parks wrote: > i have various functions (that i didn't write) that put out data in > lists of various types. But some functions (which i didn't write) that > expect the data to be scaled, sometimes 0-1 sometimes 1-2, sometimes > 0-127..., sometimes 0 - 32768... gosh you name it. In other w

Re: [Tutor] Using Beautiful Soup to extract tag names

2006-03-14 Thread Kent Johnson
Ed Singleton wrote: > I have (unfortunately) received some data in XML format. I need to > use it in Python, preferably as a list of dictionaries. The data is a > flat representation of a table, in the style: > > > Some Data > Some Data > ... > > > Some Data > Some Data > ... > > and so on (

[Tutor] Iterate over letters in a word

2006-03-14 Thread Steve Nelson
Hello, I'm trying to work on some programs to help me understand ciphers and ultimately cryptography. I've understood so far, that a simple form of bit-level cryptography is to split the original message into chunks the same length as a 'key' and then do an xor. I'm trying to keep this really si

[Tutor] Using Beautiful Soup to extract tag names

2006-03-14 Thread Ed Singleton
I have (unfortunately) received some data in XML format. I need to use it in Python, preferably as a list of dictionaries. The data is a flat representation of a table, in the style: Some Data Some Data ... Some Data Some Data ... and so on (where tablename is always the same in one file).

[Tutor] ldap client

2006-03-14 Thread Cedric BRINER
debian/sarge hello, I'm wanting to interogate an ldap server to fetch informations. so I'm looking for a python2.4 ldap client. And the only I've found is python2.4-ldaptor. Does some of you knows an good ldap client which use SSL ? Ced. -- Cedric BRINER Geneva - Switzerland

Re: [Tutor] Dynamically naming functions

2006-03-14 Thread Ed Singleton
On 13/03/06, Alan Gauld <[EMAIL PROTECTED]> wrote: > > For website, I can't really see how I can not have a dynamic > > structure. There's no way I'm writing a function for each "folder". > > Hmm, this may be a CherryPie concept thing but the vast majority > of websites do not have dynamic structu

Re: [Tutor] scaling values

2006-03-14 Thread Danny Yoo
On Tue, 14 Mar 2006, kevin parks wrote: > is there a scaling function in python (or numeric or scipy) that can > scale a list of values to a high precision? > > x = [13, 71, 120, 88, 82, 100, 10, 65, 101, 45, 26] > > foo = scale(x, 0, 1.0) Hi Kevin, I'm still confused by the problem. Let's tr

[Tutor] scaling values

2006-03-14 Thread kevin parks
i have various functions (that i didn't write) that put out data in lists of various types. But some functions (which i didn't write) that expect the data to be scaled, sometimes 0-1 sometimes 1-2, sometimes 0-127..., sometimes 0 - 32768... gosh you name it. In other words i have a bunch of bla