Re: [Tutor] re.findall vs. re.search and re.match

2005-03-15 Thread Max Noel
On Mar 15, 2005, at 21:59, Liam Clarke wrote: On Tue, 15 Mar 2005 17:09:50 +, Max Noel <[EMAIL PROTECTED]> wrote: re.findall returns a list object (as the error message says). Use name = x[1] instead. (and be careful, numbering starts from 0, so this code may contain a Kenobi

Re: [Tutor] new

2005-03-15 Thread Max Noel
On Mar 16, 2005, at 02:02, Ian Martin wrote: Hey I am new at python and i am trying to learn about it. I was wondering if you could tell me how to write a range to 100. such as 1+2+3+4+5 ect. without writing it out. Well, I'm not going to give you the full solution (that'd spoil the fun), but

Re: [Tutor] creating a tab delimited filename

2005-03-15 Thread Max Noel
On Mar 16, 2005, at 03:54, jrlen balane wrote: how would i make this the correct path: filename = "%s%s.txt" %('C:\Documents and Settings\nyer\My Documents\Info',time.strftime("%Y%m%d%H%M")) table_file = open(os.path.normpath(filename),"a") running on IDLE, i get the following error: Traceback (mos

Fwd: [Tutor] creating a tab delimited filename

2005-03-16 Thread Max Noel
Forwarding to the list -- please use Reply to All. Begin forwarded message: From: jrlen balane <[EMAIL PROTECTED]> Date: March 16, 2005 04:13:40 GMT To: Max Noel <[EMAIL PROTECTED]> Subject: Re: [Tutor] creating a tab delimited filename Reply-To: jrlen balane <[EMAIL PROTECTED]&g

Re: [Tutor] primes

2005-03-17 Thread Max Noel
On Mar 17, 2005, at 22:28, Gregor Lingl wrote: Hi! Who knows a more concise or equally concise but more efficient expression, which returns the same result as [x for x in range(2,100) if not [y for y in range(2,x) if x%y==0]] Gregor P.S.: ... or a more beautiful one ;-) Hmm... I don't have "beauti

Re: [Tutor] primes

2005-03-17 Thread Max Noel
On Mar 17, 2005, at 23:54, Danny Yoo wrote: Hi Gregor, Here is one that's traduced... er... adapted from material from the classic textbook "Structure and Interpretation of Computer Programs": Ooh, nifty. Okay, I decided to learn how to use the timeit module, so I used it to compare my algor

Re: [Tutor] primes

2005-03-18 Thread Max Noel
On Mar 18, 2005, at 02:15, Kent Johnson wrote: Max Noel wrote: #!/usr/bin/env python import math import timeit def primeConcise(limit): return [2] + [x for x in xrange(3, limit, 2) if not [y for y in [2] + range(3,x,2) if x%y==0]] def primeConciseOptimized(limit): return [2] + [x for x in

Re: [Tutor] Accessing List items

2005-03-21 Thread Max Noel
On Mar 21, 2005, at 12:57, Matt Williams wrote: for i in range(len(y)): y[i]="z" print y Surely there must be a better way than this ? Sounds like a job for... list comprehensions! (cue cheesy superhero music) y = ["z" for i in y] -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look

Re: [Tutor] problems with dictionary

2005-03-23 Thread Max Noel
On Mar 23, 2005, at 21:55, Bill Mill wrote: In line 3 of the Conv function, you write "str="The name is" + str . However, str has yet to be defined, from what I can tell. Thus, Python should throw a NameError. Unforutnately, you haven't included the exception that Python gives you with this email,

Re: [Tutor] Changing a class into a subclass

2005-03-24 Thread Max Noel
On Mar 24, 2005, at 18:07, Ismael Garrido wrote: Hello. I have a program that saves/loads to/from XML. I have a main class Building, and a subclass House(Building). When I save the code I instruct each object to save itself to XML (using ElementTree), so House adds itself to the XML tree. My pro

Re: [Tutor] max. range of list

2005-03-25 Thread Max Noel
On Mar 25, 2005, at 15:50, jrlen balane wrote: how many is the maximum member can a list have??? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor As far as I know, there is no limit hard-coded in the language. So I g

Re: [Tutor] A simple question about creating a program

2005-03-30 Thread Max Noel
On Mar 30, 2005, at 23:00, Kevin wrote: I was wondering, can you make a program the uses alot of classes do the exact same thing with out useing classes? Yes. At some point, a program always has to be translated to machine code to be executed by the processor. Machine language is not object-orie

Re: [Tutor] Class and methods?

2005-03-30 Thread Max Noel
On Mar 31, 2005, at 00:44, Kevin wrote: I am sorta starting to get it. So you could use __init__ to ask for a file name to see if there is one in a folder or not if there is then open that file and conitue where that file left off. If its not there create a new file with that name, then start the p

Re: [Tutor] Sorting more than one list

2005-03-30 Thread Max Noel
On Mar 31, 2005, at 04:19, Diego Galho Prestes wrote: Hi! I need to sort 4 lists but I need that they make the "sort together". I'll sort just one but when I change the position of the items of the 1st list I have to change the positions of the other 3 lists. Can I do this just using the sort() met

Re: [Tutor] Launching a file browser

2005-03-31 Thread Max Noel
On Mar 31, 2005, at 01:56, Kent Johnson wrote: Mike Hall wrote: I looked over the global module index and the closest thing I could find relating to my os (osx) was EasyDialogs, which has a few functions pertaining to this, "AskFileForOpen()" being one. Calling any function within EasyDialogs ho

Re: [Tutor] A simple question about creating a program

2005-03-31 Thread Max Noel
On Mar 31, 2005, at 23:07, Alan Gauld wrote: And if Sun ever get round to finishing their JVM on a chip we'll have a chip that is both OO and procedural! At that point it would be a JRM, then, wouldn't it? :D -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic c

Re: [Tutor] Launching a file browser

2005-03-31 Thread Max Noel
On Apr 1, 2005, at 00:14, Mike Hall wrote: On Mar 31, 2005, at 12:21 AM, Max Noel wrote: It's been too long since I used Python on MacOSX, but IIRC you can't just run a Python GUI program from the shell. Or something like that...you should ask this one on the python-mac SIG mailing

Re: [Tutor] Sorting more than one list

2005-04-01 Thread Max Noel
On Apr 1, 2005, at 09:59, Alan Gauld wrote: Since the data are obviously related (since you need to keep them linked), I'd be inclined to merge the lists into a list of tuples merged = [(a,b,c,d) for a in l1 for b in l2 for c in l3 for d in l4] Then you can sort 'merged' and it should just work

Re: [Tutor] Self referencing within a dictionary

2005-04-02 Thread Max Noel
On Apr 2, 2005, at 12:12, Liam Clarke wrote: Hi, Out of curiosity, is it possible to create a dictionary like this - foo = {'a':1, 'b':2, 'c':foo['a']} I know that as above doesn't work, but was just wondering if it's possible, and if it's a Bad Thing? Regards, Liam Clarke It doesn't work because

Re: [Tutor] building strings of specific length

2005-04-04 Thread Max Noel
On Apr 4, 2005, at 16:04, Vines, John (Civ, ARL/CISD) wrote: Hello. I have a question regarding strings. How do I format a string to be a specific length? For example I need 'string1' to be 72 characters long. Thanks for your time, John You can use the string methods ljust, rjust and zfill:

Re: [Tutor] newb problem running the translator (fwd)

2005-04-09 Thread Max Noel
On Apr 9, 2005, at 10:36, Danny Yoo wrote: -- Forwarded message -- Date: Fri, 8 Apr 2005 22:03:58 EDT From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: newb problem running the translator I will try to make this quick. I am a newb to python, and programming at that, but i

Re: [Tutor] quicksort using list comprehension

2005-04-09 Thread Max Noel
On Apr 9, 2005, at 21:50, Kent Johnson wrote: I think you have to return a value when len(t) <= 1. You don't return anything which means you return None which can't be added to a list. Kent Yup. Here's a quicksort I did, adapting an example from the Wikipedia article on Haskell: def qsort(toSo

Re: [Tutor] when to use properties?

2005-04-13 Thread Max Noel
On Apr 12, 2005, at 23:22, Danny Yoo wrote: There was an interesting article by Phillip Eby about what conventions work and don't work when one makes a jump from Java to Python: http://dirtsimple.org/2004/12/python-is-not-java.html A very interesting read. Thanks for the link, Danny! -- Max

Re: [Tutor] odd behavior within __init__

2005-04-14 Thread Max Noel
On Apr 14, 2005, at 12:58, Orri Ganel wrote: a = Node(1) b = Node(a) 12932600 12932600 1 id(b) 12960632 Any ideas on why this happens, or suggestions as to how to implement the behavior I'm looking for (in which b and a would refer to the same object, have the same id, etc.), would be greatly appre

Re: [Tutor] Question regarding the len function of a list while using a loop

2005-04-14 Thread Max Noel
On Apr 14, 2005, at 14:14, Ben Markwell wrote: Could somebody explain to me why the code I used to complete this exercise doesn't work. And how do you send an integer to len? Well, I think you've successfully completed that exercise. len() doesn't work on integers because integers don't have a

Re: [Tutor] Re: Recursion....what are the best situations to use it?

2005-04-14 Thread Max Noel
On Apr 14, 2005, at 21:06, [EMAIL PROTECTED] wrote: I've seen a couple of nice tutorials on recursion, and a lot of awful ones. The latter always trot out the fibonacci and factorial examples for some reason. And that's about it! The good ones showed me how to trace through recursive calls and g

Re: [Tutor] high score lists

2005-04-14 Thread Max Noel
On Apr 15, 2005, at 01:33, D. Hartley wrote: This is what I have so far: high_scorelist = [(1000,"Denise"), (945,"Denise"), (883,"Denise"), (823,"Grant"), (779,"Aaron"), (702,"Pete"), (555,"Tom"), (443,"Tom"), (442,"Robin"), (404,"Pete")] userscore = (441,"Joe") de

Re: [Tutor] high score lists

2005-04-15 Thread Max Noel
On Apr 15, 2005, at 03:32, [EMAIL PROTECTED] wrote: Interestingly, the key argument is the solution to this problem: arr = zip(range(10), range(10,0,-1)) arr [(0, 10), (1, 9), (2, 8), (3, 7), (4, 6), (5, 5), (6, 4), (7, 3), (8, 2), (9, 1)] arr.sort(key=lambda x: x[1]) arr [(9, 1), (8, 2), (7, 3),

Re: [Tutor] high score lists

2005-04-15 Thread Max Noel
On Apr 15, 2005, at 21:30, D. Hartley wrote: Unless you can explain what "lambda x: x[1]" does, in preschool-speak ;) That's an anonymous function, also known as a lambda function. Let's take an example: >>> a = range(10) >>> a [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> map(lambda x: 2*x, a) [0, 2, 4, 6

Re: [Tutor] Has anyone ever tried to convert the textual output of the dis module to another language

2005-04-17 Thread Max Noel
On Apr 17, 2005, at 16:51, Sean Perry wrote: R. Alan Monroe wrote: Just curious. Googling for 'python "dis module" convert "another language" ' only got two hits. So maybe no one is trying it? I was just daydreaming about a native python compiler, and wondered how feasible it would be. There is alr

Re: [Tutor] More Function Questions (Joseph Q.)

2005-04-17 Thread Max Noel
On Apr 17, 2005, at 17:29, Joseph Quigley wrote: So what do you use the def bar(x, y): return x + y bar(4, 5) functions for? (I just need a simple example) Whenever you have something that you may want to do more than once and/or in more than one place in your program. Here's a small exam

Re: [Tutor] Problems with encodings

2005-04-18 Thread Max Noel
On Apr 18, 2005, at 16:55, Olli Rajala wrote: Michael, does it help if you change the second line into: # -*- coding: iso-8859-15 -*- ? I *think* that is the correct syntax (at least it works for me). Thanks, it doesn't give the error message anymore. But non-ascii letters still don't go well from

Re: [Tutor] Of fish and foul...(aka the Perl require command)

2005-04-18 Thread Max Noel
On Apr 18, 2005, at 19:59, Smith, Jeff wrote: Is there a Python equivalent to the Perl require 5.6.0 Which enforces a minimum interpreter version? As far as I know, no. But: >>> import sys >>> sys.version_info (2, 3, 0, 'final', 0) >>> (2, 4, 0) > sys.version_info True >>> (2, 2, 0) > sys.versi

Re: [Tutor] unrelated sound error - pygame, or other?

2005-04-18 Thread Max Noel
On Apr 18, 2005, at 23:18, D. Hartley wrote: Another quick question. I tried to send a file to my friend to test it out, and it gave her the following sound-related error: Cannot load sound: data\explode2.wav Traceback (most recent call last): File "D:\Python24\play w paused screen residue.py",

Re: [Tutor] TKinter and things over Linux

2005-04-19 Thread Max Noel
On Apr 19, 2005, at 13:49, Alberto Troiano wrote: Hi I have another problem. It seems that I manage to solve a problem and run into another The problem is that now I can't install MySQLdb (MySQL database module for Python 2.3.4) I try to ./configure and it prints a lot of crap and then says mys

Re: [Tutor] TKinter and things over Linux

2005-04-19 Thread Max Noel
On Apr 19, 2005, at 19:57, Alberto Troiano wrote: Thanks Danny I will try to do that and let you know how it went But one question thou, does it matter the location where I gunzip the distutil If so where should I put it??? NOTE: It's just to be sure that I'm understanding righ

Re: [Tutor] Dynamically composing a module name

2005-04-19 Thread Max Noel
On Apr 19, 2005, at 21:22, Tim Johnson wrote: Hello Pythonmeisters: Is it possible to dynamically compose a module name for import? Pointers to documentation or other discussions would be sufficient at this time. thanks Ah, metaprogramming. I must admit I can't think of a way. Or rather, I did t

Re: [Tutor] How to obfuscate a database password.

2005-04-19 Thread Max Noel
On Apr 20, 2005, at 01:29, Danny Yoo wrote: Is there a convention for obfuscating database passwords? Hi David, Most people run passwords through some sort of hashing function. That is, databases almost never contain passwords in the clear, but instead store the hashes of those passwords. For

Re: [Tutor] Installation Routines (Joseph Quigley)

2005-04-20 Thread Max Noel
On Apr 20, 2005, at 00:04, Joseph Quigley wrote: My point is for practice and knowledge. Sure, I have Setup 2 Go (the paid version) and Install Creator (not paid) Then again, how many free installers are there for linux? emerge and apt-get come to mind. rpm is inferior (no dependency resolution)

Re: [Tutor] TKinter and things over Linux

2005-04-20 Thread Max Noel
On Apr 20, 2005, at 16:52, Alberto Troiano wrote: Hey Didn't work I try the python2.3 setup.py build I couldn't print the exact error because it's a lot of pages that says mostly the same the final error says error: mysql ended exit with status 1 I run the other command python2.3 setup.py install

Re: [Tutor] crash - switching between text window and graphics/gamewindow (high score)

2005-04-20 Thread Max Noel
On Apr 20, 2005, at 23:57, Alberto Troiano wrote: Hi The thing is this I get an error that says sort() has no arguments Th error is in the sentence high_score.sort(reverse=TRUE) If you put just sort() it will work but the list will show from low to high and we don't want that 'cause if you make a

Re: [Tutor] crash - switching between text window and graphics/gamewindow (high score)

2005-04-20 Thread Max Noel
On Apr 21, 2005, at 00:19, D. Hartley wrote: Max - I thought it might be a version issue as well, thanks. Also, good luck on your paper! 50 pages, whoo! Haven't done that since grad school, my condolences man. ~Denise :) Thanks... I'm almost done now, only a few more pages and all that will be l

Re: [Tutor] Re: [Pythonmac-SIG] Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-22 Thread Max Noel
On Apr 22, 2005, at 11:41, Chris Smith wrote: Do you have a suggestion as to what can I give a module so it has enough information to execute a function that resides in __main__? Here is a visual of what is going on: --__main__ def y1(): pass import foo foo.run(string_from_main) #what shou

Re: [Tutor] Newbie Question:Regarding Command line Parsing and Run Unix Shell Command

2005-04-23 Thread Max Noel
On Apr 22, 2005, at 21:09, Prasad Kotipalli wrote: Hello evryone I am a newbie to python. I have a makefile which i can compile in UNIX/LINUX, But i I am planning to write a python script which actually does what my MAKEFILE does. Then what you want is SCons (http://www.scons.org/). Haven't h

Re: [Tutor] Re Help with this script

2005-04-23 Thread Max Noel
On Apr 23, 2005, at 15:44, John Carmona wrote: Thanks Kent, it is working now. Is this what you meant in your reply? Because if I set up the main code at the end of the script I was still getting an error message. Also, what do I need to use if for example I want my code to rerun once I have co

Re: [Tutor] "saving"?

2005-04-24 Thread Max Noel
On Apr 24, 2005, at 18:04, Gavin Bauer wrote: I've decided it would be cool to make a flashcard program. You would start by entering all of the cards and their answers, then it would ask you them in random order, with ones you get right coming up less often, and ones you consistantly get wrong comi

Re: [Tutor] Highlighting instructions: pedagogical preferences

2005-04-25 Thread Max Noel
On Apr 25, 2005, at 17:03, André Roberge wrote: I'm writing a program "interpreter" which has two windows: a program editing window and a program output window. The interpreter can either step through the program automatically, at a slow pace, or step through the program one instruction at a tim

Re: [Tutor] font/text in pygame

2005-04-26 Thread Max Noel
On Apr 26, 2005, at 23:57, D. Hartley wrote: But in any case, font/text will only take strings - i cant pass in a list, or an index to an item in a list (which is, in this case, a tuple), and since the items in the list will be changed and updated obviously i cant just type in the items as strings

Fwd: [Tutor] font/text in pygame

2005-04-26 Thread Max Noel
[Forwarding to the list. Please use "Reply to all", not "Reply", if you want your reply to a message to go to the list] Begin forwarded message: From: "D. Hartley" <[EMAIL PROTECTED]> Date: April 27, 2005 01:36:26 BST To: Max Noel <[EMAIL PROTECTED]>

Re: [Tutor] font/text in pygame

2005-04-26 Thread Max Noel
On Apr 27, 2005, at 01:36, D. Hartley wrote: I haven't programmed in C (python is my first language!), but I *have* done something like this before, only with the print command: def displaybalance(): for score, name in mylist: slip = 30 - len(name) slip_amt = slip*" " pr

Re: [Tutor] properties and subclasses

2005-04-26 Thread Max Noel
On Apr 26, 2005, at 22:01, Alan Gauld wrote: I had found the first thread you linked. I see what you mean about the cure -- my general belief is that *I* am unlikely to have problems for which meta-classes are really the best solution :-) Once you get used to them meta-classes are very useful. In

Re: [Tutor] Help with daemon

2005-04-27 Thread Max Noel
On Apr 27, 2005, at 22:35, Alberto Troiano wrote: I'm gonna give you an example: The program will check for new users and to check record time every 10 seconds. But first the program will have to finish the checking process that started before so it won't be 10 seconds right? Unless I have one pr

Re: [Tutor] Help with daemon

2005-04-28 Thread Max Noel
On Apr 28, 2005, at 23:06, Alberto Troiano wrote: I tried: import os os.system("ps --user root") and I get 0 as a return How can I get the PID and bind the command above with a variable?? I mean varusername="root" os.system("ps --user varusername") works??? So in essence, what you're trying t

Re: [Tutor] cPickle (Joseph Q.)

2005-04-29 Thread Max Noel
On Apr 29, 2005, at 04:48, Joseph Quigley wrote: Hi all, How could I have the user name his file? I learned that I type file_name = "foo.bar" How could I make it that the use could name it "hello.hi"? Thanks, Joe Well, all you have to do is have the user input a string, and use this st

Fwd: [Tutor] cPickle (Joseph Q.)

2005-04-29 Thread Max Noel
Begin forwarded message: From: Joseph Quigley <[EMAIL PROTECTED]> Date: April 29, 2005 17:16:22 BST To: Max Noel <[EMAIL PROTECTED]> Subject: Re: [Tutor] cPickle (Joseph Q.) I tried that and it doesn't work! I type the name and it just sits there! Here's the code: # v

Re: [Tutor] guess the number game help

2005-04-30 Thread Max Noel
On Apr 30, 2005, at 09:49, Diana Hawksworth wrote: Hello list!   I have started teaching Python to a group of High School students. I set them the "Guess the Number" game as a GUI as an assignment. One of the students has passed in some script that is foreign to any tutorial work we have done. 

Re: [Tutor] guess the number game help

2005-04-30 Thread Max Noel
On Apr 30, 2005, at 19:50, Alan Gauld wrote: If my student has plagiarised - I need to know. Could you ask him(?) to explain some of the more "interesting" features? Maybe how he came up with the variable names? It is possible that he/she has come up with it themselves since its not really a great

Re: [Tutor] Problem with threading

2005-05-03 Thread Max Noel
On May 3, 2005, at 08:57, Danny Yoo wrote: > I believe that cron has a resolution of a minute, so now it doesn't > sound > that cron is so viable. But how about writing a program that just > continues to run as a "daemon" service in the background? A simple > example is something like: >

Re: [Tutor] Problem with threading

2005-05-03 Thread Max Noel
On May 3, 2005, at 20:52, Danny Yoo wrote: > ## >cron(8) examines cron entries once every minute. > >The time and date fields are: > > field allowed values > - -- > minute 0-59 >

Re: [Tutor] Psyco (Joseph Quigley)

2005-05-04 Thread Max Noel
On May 4, 2005, at 16:35, Joseph Quigley wrote: > For those who use Psyco: > Is it any good? I'm searching for instructions on how to use > it, should I > stop? I hear it's quite good at what it does. Note, however, that it only works on x86 computers (i.e. IBM PC compatibles).

Re: [Tutor] Python riddles

2005-05-05 Thread Max Noel
On May 5, 2005, at 00:53, [EMAIL PROTECTED] wrote: > As seen on python-announce (via Dr Dobbs): > > http://www.pythonchallenge.com/ > > Good fun! > Very interesting indeed! I'm stuck on number 7, though -- looks like it requires the use of PIL, which I've never used before. -- Max maxnoe

Re: [Tutor] Dictionary Inserts...

2005-05-05 Thread Max Noel
On May 5, 2005, at 16:37, Allen John Schmidt, Jr. wrote: > Ok, I have had enough. I have looked all through the python docs and I > cannot find it. How do you insert an entry into a dictionary? > The way you think it's done: >>> a = {'foo': 1, 'bar': 2} >>> a {'foo': 1, 'bar': 2} >>> a[

Re: [Tutor] Fwd: Python riddles

2005-05-05 Thread Max Noel
On May 5, 2005, at 19:39, D. Hartley wrote: > Ok, now, I'm sure this sounds like a very dumb question. But I > clicked on riddle 1, and I don't know how this thing works - "about" > didnt give a lot of extra info. Am I trying to duplicate something on > my screen that looks like the picture on

Re: [Tutor] python challenges

2005-05-05 Thread Max Noel
On May 6, 2005, at 01:10, D. Hartley wrote: > Anyone have a gentle hint, or pointer to another 'beginner' tutorial > to regular expressions? > > Thanks! I dont want to get stuck here in the riddles! > > ~Denise I learned most of what I know about regular expressions while I was learning P

Re: [Tutor] python challenges

2005-05-05 Thread Max Noel
On May 6, 2005, at 01:33, D. Hartley wrote: > They do seem to be useful! But with all those special characters, it > certainly doesnt make for an easy read. I think I'm making some > progress - I got it to make me a list of all the > {uppercaseuppercaseuppercaselowercaseuppercaseuppercaseupperca

Re: [Tutor] python challenges

2005-05-06 Thread Max Noel
On May 6, 2005, at 21:06, Alberto Troiano wrote: > Hey > > I'm stucked in number 5 > It says pronounce it and there is nothing else not in page nor in > the source > code > What can I do?? Well... Go ahead and pronounce it (the title of the page, that is)... Sounds awfully close to a ce

Re: [Tutor] python challenges

2005-05-06 Thread Max Noel
On May 6, 2005, at 21:40, D. Hartley wrote: > I figured out what module you're supposed to use for 5, and the thing > that kills me is it's a module I've actually *used* too! But I don't > know what to . man this is hard to say without using a spoiler. I > dont know what particular thing to a

Re: [Tutor] python challenges

2005-05-06 Thread Max Noel
On May 6, 2005, at 21:57, Tim Peters wrote: > What do you have against PIL ? Nothing in particular, just no idea how to use it. > simple ways has been part of the fun for me. I don't know how you > solved level 7, Hint: it's a stupid and inelegant method involving a certain progra

Re: [Tutor] python challenges

2005-05-06 Thread Max Noel
On May 6, 2005, at 22:20, D. Hartley wrote: > Yes, I realized my original guess was wrong. I think I found the > target file but now none of the module commands I'm used to will do > anything useful on it. I'm just getting "file not found" errors and > the like. There's something in the big pictu

Re: [Tutor] python challenges

2005-05-06 Thread Max Noel
On May 6, 2005, at 22:32, D. Hartley wrote: > Maybe that's my problem. I dont know how to save this particular file > onto my computer first. I can't 'reach' it from the url. It's not > like a picture I can right click on and save image, or something. My > first thought was i needed to use th

Re: [Tutor] Generator function question?

2005-05-07 Thread Max Noel
On May 7, 2005, at 12:28, John Clark wrote: > My question - the creation of the global variable x seems kludged - > when I > first started with this I thought I was going to be coding > something like > sys.stderr.write('\b'+neverEndingStatus()) but that just returns > '\' each > time and I

Re: [Tutor] Generator function question?

2005-05-07 Thread Max Noel
On May 7, 2005, at 13:22, John Clark wrote: > (Either that, or I am not following what you mean when you say: > > >> As for how to access it, use a for loop (for i in >> neverEndingStatus()). xrange, for example, is a generator function. >> > > Can you please provide an example of how my Tes

Re: [Tutor] python challenges

2005-05-07 Thread Max Noel
On May 7, 2005, at 13:17, John Carmona wrote: > Hi to everybody reading this thread, can anybody point me to the > URL where I can find these challenges. Many thanks > > JC > http://www.pythonchallenge.com/ -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathe

Re: [Tutor] Generator function question?

2005-05-07 Thread Max Noel
On May 7, 2005, at 15:06, Max Noel wrote: > Try the following code: > > > > for i in neverEndingTest(): > print i > Sorry, i meant "for in in neverEndingStatus()" (not neverEndingTest()), where neverEndingStatus is the function I gave as an e

Re: [Tutor] python challenges

2005-05-07 Thread Max Noel
On May 7, 2005, at 20:50, D. Hartley wrote: > Ok, I hate to ask another question about this riddle. But I have > looked and looked and looked. > > Where can I find more information on 'banner'? Everywhere I look it > starts telling me about banner ads and so on, and that is not what I > want! >

Re: [Tutor] Else in list comprehension

2005-05-07 Thread Max Noel
On May 8, 2005, at 03:02, Bernard Lebel wrote: > Hello, > > I just started using list comprehensions (loving them!) > > I know you can add an if statement, but can you put in there an else? > I could not find an example of this. > Apparently, no. I just tried: >>> b = [i for i in range(10

Re: [Tutor] How do I squish this bug?

2005-05-09 Thread Max Noel
On May 9, 2005, at 17:57, Joseph Quigley wrote: > Why do I get the error: >NameError: global name 'main' is not defined > > when switching between the two module twice (ie: type: jargon > type:back() > type:jargontype:back() )? > > Thanks > JQ > Namespaces. Each module has

Re: [Tutor] zip question

2005-05-09 Thread Max Noel
On May 10, 2005, at 01:18, D. Hartley wrote: > I admitted that my grasp of classes (and "constructors") is a bit > fuzzy. I did get this particular class to work, and got the first half > of the problem done. However, now i'm working in another class, > zipinfo. It says: > > Instances of the Zip

Re: [Tutor] python challenges

2005-05-11 Thread Max Noel
On May 11, 2005, at 07:23, Liam Clarke wrote: > Ack, banner.p eh? > > Can anyone explain the significance of the numbers? Are they columns? > > Regards, > > > Liam Clarke As I said, read about Run-Length Encoding. -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A

Re: [Tutor] character format

2005-05-11 Thread Max Noel
On May 12, 2005, at 01:50, [EMAIL PROTECTED] wrote: chr(130) > '\x82' > > If you look at http://asciitable.com/, you will see that ascii > chracter 130 is > an e with a tick on its head. This is not something you can find > on your > keyboard, so python can't/won't display it. >

Re: [Tutor] character format

2005-05-11 Thread Max Noel
On May 12, 2005, at 02:22, D. Hartley wrote: > Max - yep, and the hint was "BUSY" (... BZ...)... > > Unfortunately that hint doesnt lead me anywhere (except to bz2, which > involves compression, and didnt seem very likely). > > I went through and removed all the \x## 's that represented > 'unprin

Re: [Tutor] character format

2005-05-12 Thread Max Noel
On May 12, 2005, at 02:42, Tony Meyer wrote: >> >> From the email address, chances are that this was a New Zealand >> cultural >> > assumption. Ah, the French, lumping all English speakers under the > American > banner . Touché. :D -- Max ( What makes it even more unforgivable is that

Re: [Tutor] character format

2005-05-12 Thread Max Noel
On May 12, 2005, at 03:00, [EMAIL PROTECTED] wrote: > As was pointed out, I'm not American. I guess the problem stems > from an > American cultural assumption, though, in that Americans (I think) > developed the > ASCII character set without any thought for other languages. At that tim

Re: [Tutor] Help with Challenge number 5

2005-05-12 Thread Max Noel
On May 13, 2005, at 01:30, Jacob S. wrote: > Okay, I've tried pickling, marshal, marshalling, serialization, and > amazingly pi because I noticed that pickle was under the section 3.14 > however, none of this worked, so, I hate to ask again but, could > you go one > step farther? > > Thanx, > J

Re: [Tutor] Simple string processing problem

2005-05-13 Thread Max Noel
On May 13, 2005, at 20:36, [EMAIL PROTECTED] wrote: > Hi, > > i am a Biology student taking some early steps with programming. I'm > currently trying to write a Python script to do some simple > processing of a > gene sequence file. Welcome aboard! > A line in the file looks like: > SCER

Re: [Tutor] Linux variable to Python

2005-05-13 Thread Max Noel
On May 13, 2005, at 21:03, Alberto Troiano wrote: os.system("fec=cam`date +%Y%m%d%H%M%S`.jpg") > 0 > os.system("echo $fec") > 0 > os.system("mv hola.txt grabacion/$fec") > 0 > > Then I check for the file and turns out that it moved hola.txt to > grabacion > with th

Re: [Tutor] Testing for commandline args

2005-05-13 Thread Max Noel
On May 14, 2005, at 01:30, William O'Higgins wrote: > if sys.argv[1]: > do stuff > else: > do different stuff > > If I have arguments, the "different stuff" happens beautifully, thank > you very much. If I don't have arguments I get this: > > if sys.argv[1]: > IndexError: list index out

Re: [Tutor] help: space formatting for multiplication table

2005-05-14 Thread Max Noel
On May 14, 2005, at 20:09, Aaron Elbaz wrote: > The idea is to print out a multiplication table on the command line > with numbers lining up in the ones column. I want to eventually > emulate programs like top with their spacing. But this code is mostly > for my amusement. How would you make this

Re: [Tutor] How to verify all things are equal to one another

2005-05-15 Thread Max Noel
On May 15, 2005, at 06:54, Terry Carroll wrote: > if (a == b & > a == c & > a == d & > a == e & > a == f & > a == g): > do stuff > Well, you can already try this: if a == b == c == d == e == f == g: do stuff -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "

Re: [Tutor] Directory not empty :: Fast mode

2005-05-16 Thread Max Noel
On May 16, 2005, at 18:30, Jonas Melian wrote: > To knowing if a directory isn't empty, I use: > > dir_example = "/usr/foo/" > > if glob.glob(os.path.join(dir_example, "*")): > ... > > > But, as it has to expand all files, i'm supposed that it's a little > slow > to simply knowing if a dire

Re: [Tutor] Removing lines in string-table

2005-05-17 Thread Max Noel
On May 17, 2005, at 08:52, Olli Rajala wrote: > Okay, > I have a string table (don't recall the right word used in Python > right now) It's called a list, or an array. > and would like to remove every 'cell' that contains a > string '_thumb.jpg'. There are 1-> digits before the string if t

Re: [Tutor] Perl equivalent of $#var

2005-05-17 Thread Max Noel
On May 17, 2005, at 22:00, Smith, Jeff wrote: > Is there a more Pythonic way to get the Perl equivalent of > $#var > other than > len(var) - 1 AFAIK, len(var) - 1 is the only way. Note, however, that the last element of a list (or of any ordered sequence) can be obtained with th

Re: [Tutor] dictionary values in strings

2005-05-19 Thread Max Noel
On May 19, 2005, at 20:49, William O'Higgins wrote: > I am trying to discover the syntax for call on a dictionary of > lists by > key and index. > > The data structure looks like this: > > dol = {'key1':['li1','li2','li3'],'key2':['li1','li2','li3'],\ > 'key3':['li1'li2,'li3','']} > > The keys

Re: [Tutor] diving into py question

2005-05-19 Thread Max Noel
On May 19, 2005, at 22:18, Chelan Farsight wrote: > I am using the online book Dive Into Python. > I ran the first program given and have run into an error on line 7 at > the colon. Now I imagine that there is probably a corrections page at > the site, but I am interested in knowing why it won't

Re: [Tutor] diving into py question

2005-05-19 Thread Max Noel
On May 19, 2005, at 22:46, Chelan Farsight wrote: > Thanks! > You were right about the double underscore, however, I am still > getting the error on line 7...hrmm > any other ideas? > In your original code, the space between if and __main__ is also missing. This may be the source of the e

Re: [Tutor] kernel serie

2005-05-19 Thread Max Noel
On May 19, 2005, at 23:28, Jonas Melian wrote: > I want get the kernel serie, so 2.x only (2.6 or 2.4) > > info_kernel = platform.release() # get the kernel version > info_kernel = '.'.join(info_kernel.split('.',2)[:2]) > > is there any way of get it in one line only? Based on your code, th

Re: [Tutor] using -i flag with '''if __name__ == "__main__":'''

2005-05-19 Thread Max Noel
On May 19, 2005, at 23:05, Terry Carroll wrote: > Thanks to you both. I think I may need to step up my "development > environment" beyond emacs and a command line. Actually, if you're having problems with debugging your problem, what you should step up is your approach to debugging/testi

Re: [Tutor] looking for a pattern in a lot of files

2005-05-22 Thread Max Noel
On May 22, 2005, at 21:07, Jonas Melian wrote: > for line in fileinput.input(glob.glob(os.path.join > (dir_locales, "*_[A-Z][A-Z]"))): > if re.search("locale for", line): > print line If you're only looking for the occurrence of a string and not a regex pattern, you do

Re: [Tutor] Filtering Spreadsheet Data

2005-05-24 Thread Max Noel
On May 24, 2005, at 14:22, Mike Hansen wrote: > Excel has some nice database-like queries itself. Take a look at > Advanced Filter > in Help. You can essentially query a worksheet and even send the > results to a > different worksheet. I'd imagine that once you got the query > working, you

Re: [Tutor] Python won't play wav file

2005-05-24 Thread Max Noel
On May 24, 2005, at 02:49, Joseph Quigley wrote: > ... to play a .wav music file. I tried w.play() but got an error that > module has no attribute 'play'. > What do I use to get it to play? > Thanks, The wave module is meant to read, write and manipulate (transform, filter, whatever) WAV

<    1   2   3   >