Re: [Tutor] What does "random" in shuffle( x[, random]) do?

2006-09-03 Thread Luke Paireepinart
3][1, 4, 2, 3][1, 4, 2, 3][1, 4, 2, 3][1, 4, 2, 3][1, 4, 2, 3][1, 4, 2, 3][1, 4, 2, 3][1, 4, 2, 3][1, 4, 2, 3] [1, 4, 2, 3][1, 4, 2, 3][1, 4, 2, 3]>>> So yes, I have already given you an example where the second argument does something.Or do you still think that it's random? :) Thanks,

Re: [Tutor] Some questions about my yen-USD.py

2006-09-07 Thread Luke Paireepinart
() it gets 2 successive calls. I can't figure out why. Would IDLE's debugger be of use here? (I've never used it before.) Ihaven't been able to find up-to-date IDLE help.   Didn't look at the code closely enough to tell, and I

Re: [Tutor] error in writelines

2006-09-10 Thread Luke Paireepinart
utfile.close() outputfile.close() I think that should work. I don't have the files you're running this all on, though. It might help if you gave us the text of a successful file and of 107. HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] please do not post question about writelines

2006-09-10 Thread Luke Paireepinart
helps you anyway. Also, whenever you e-mail tutor@python.org it automatically sends to us all, there's not some middleman who reads over the e-mails. It seemed to me like you thought this was happening from your 'please don't post my question&#

Re: [Tutor] foreach loops

2006-09-11 Thread Luke Paireepinart
. "\n"; } #--- python code: names = ['Larry','Curly','Moe'] print "Who's on the list?\n" for x in mynames: print x+'\n' # Am I missing the point here? -Luke > Good luck! >

Re: [Tutor] foreach loops

2006-09-11 Thread Luke Paireepinart
ductory Python tutorial. Any one of them should cover the types of questions that people from other languages have about Python. It sounds like you know how to program already, so the 'python for non-programmers' type of tutorial may not be best-suited

Re: [Tutor] HTML page status

2006-09-12 Thread Luke Paireepinart
you can capture the returned headers and look at the error code. 404 if the page wasn't found,etc etc. I'm really bad at using it so I won't attempt to give you an example. GIYF I guess :) -Luke > Thanks > > Johan > > > ___

Re: [Tutor] about assert

2006-09-13 Thread Luke Paireepinart
tter explanation of this, but I have to get to class. HTH, -Luke > Thanks, > Linda > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Methods and classes

2006-09-13 Thread Luke Paireepinart
#x27;, 's'. However, if you attempt to name it something other than 'self', or occasionally 's', other programmers might get scared. Especially if you name it 'int' or something :) HTH, -Luke > Kent > >

Re: [Tutor] (no subject)

2006-09-14 Thread Luke Paireepinart
call these files? > > You can iterate through each line of a file like this: > > input = open('/Users/timothy/Desktop/t' , 'r') > for line in input: > # ... > Good example, except you shouldn't use 'input' since it's a builtin. :D

Re: [Tutor] Problems serving up PDF

2006-09-14 Thread Luke Paireepinart
making it attempt to open the file. You could just as well configure Firefox to automatically open these files too, although that doesn't mean that it'll work :) So unless you can be more specific, I'd say that it's just a difference in the browser and not a problem with yo

Re: [Tutor] Problems serving up PDF

2006-09-14 Thread Luke Paireepinart
at the browser knows it's done reading the header and it should start decoding the html code. That's all I was referring to. I don't know if you are supposed to use \r\n always or just in the header section, but I bet browsers would handle either case just fine. That&

Re: [Tutor] pymssql or ODBC

2006-09-14 Thread Luke Paireepinart
Chris Hengge wrote: > 4.5 hours... all I'm seeing are a few other libraries, none of which > mention having windows authentication :/ > > On Thu, 2006-09-14 at 16:12 -0700, Chris Hengge wrote: > >> Does anyone know how to make pymssql use windows authentication? >> >> No, but if you know

Re: [Tutor] pymssql or ODBC

2006-09-15 Thread Luke Paireepinart
arated by a semicolon) So the way you showed and the method Joe used should be equivalent (except his is shorter and yours is more readable :) HTH, -Luke > I am not at work so I dont have the server to run this code against, but > it looks like you ar

Re: [Tutor] Limitation of range() function in Walking problem

2006-09-15 Thread Luke Paireepinart
xt number) but it won't eat up all that memory > 3. is solution that I have, is it appropriate. > I don't know, I'm in the middle of writing some code and I don't want to forget what I was doing, so I didn't read any of yours. Hope the xrange tip helps, though. Ano

Re: [Tutor] i just cant do it

2006-09-17 Thread Luke Paireepinart
blems that you have no idea how to solve, and you have to tell us what steps you took to _try_ to solve it, so we can tell you what the next step is. If we just give you answers to your questions, you won't have learned anything, right? :) > I know im a noob sorry U-U That's what the list is here for! But we also want to help you get un-newbied as fast as possible :) > > -- > Best Regards. > fedekiller -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Some questions about my yen-USD.py

2006-09-17 Thread Luke Paireepinart
cimal data type variables... Eg. #code: context = decimal.Context() #replace this line with your customized context... decimal.setcontext(context) d= decimal.Decimal('6') e = decimal.Decimal('3') print d/e #output: 2 Again, for the precision and such that you'll want for this, look into making a custom context. > Thanks in advance, > > Dick Moores > Sure :D -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] python text adventures question

2006-09-17 Thread Luke Paireepinart
to do this eventually. Maybe during the winter break. That is, if I can take a break from the Wii! Teh Calculus 2 among other things are consuming quite a bit of my time at the moment, so I probably couldn't start on it this semester, but if I get around to working on this at all

Re: [Tutor] Python Course at Foothill College

2006-09-17 Thread Luke Paireepinart
as well? (I don't live anywhere near CA, I'm just interested.) Wish my school used Python. -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Luke Paireepinart
gt; Function names should be lowercase, with words separated by >>> underscores as necessary to improve readability. >>> >> It may be the official style but in practice its not that widely >> followed. >> Yeah, I haven't seen too much of that going on. Most pieces of Python code I read have some crazy syntax that I've never seen before. I learn new things every day :D -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Some questions about my yen-USD.py

2006-09-18 Thread Luke Paireepinart
anything is good practice. For example, my dream is to one day write a NES emulator in Python, and this has already been done dozens of times in C, C++, Java, even Visual Basic. I don't care, my goal is the same whether or not I'm reinventing the wheel. :) I know of no NES emulat

Re: [Tutor] How to convert a decimal integer into binary

2006-09-18 Thread Luke Paireepinart
Asrarahmed Kadri wrote: > Can anyone help me with teh problem of "converting a decimal number > into its binary equivalent"?? > How is your decimal number stored? > Thanks in anticipation. > > Regards, > Asrar Kadri > >

Re: [Tutor] How to convert a decimal integer into binary

2006-09-18 Thread Luke Paireepinart
e program, but see what you can do. Basically, if I remember correctly, you have to find the smallest power of 2 that is greater than your number, then repeatedly divide then mod the integer for each binary digit. > Thanks in anticipation. sure. > > Regards, > Asrar Kadri -Luke ___

Re: [Tutor] (no subject)

2006-09-23 Thread Luke Paireepinart
Jeff Sadino wrote: > I would like to write a python script that runs an executable program. If I > have a program here: > > C:\My Document\Program.exe > > how would I execute that program from within a python script? > you could use the os module. os.system() lets you run system commands. Or m

Re: [Tutor] file open (take 2)

2006-09-27 Thread Luke Paireepinart
>> I am trying to read in an ascii text file, do some alterations and write it >> back. >> Sounds like a pretty useful thing to do :) >> file = open(self.config.get('pdf','cert') + '/cert.pdf' , 'r+') >> lines = file.readlines() >> Not sure what self.config.get here is doing, but that's

Re: [Tutor] about mainloop

2006-09-27 Thread Luke Paireepinart
isplay, so if on Mac it's running in a separate process, it can't use the mainloop IDLE is already running. HTH, -Luke > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] revisiting struct module

2006-09-28 Thread Luke Paireepinart
,chr(0),chr(0),chr(0),200) Is probably how you'd do it. > > This is actually only part of the message, but I am trying to learn > this as i go. Sounds like a plan. HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] revisiting struct module

2006-09-28 Thread Luke Paireepinart
shawn bright wrote: > Luke ! > > That worked ! > Man, if you knew how i have pulled my hair out over this for a while. Well, I don't know how your experience in particular has been, but I know I've had moments like that quite often. That's what the tutor list is

Re: [Tutor] python text adventures question

2006-09-29 Thread Luke Paireepinart
doug shawhan wrote: > I got a copy of Creating Adventure Games on Your Computer in the mail > yesterday. > > Very fun! I set up a moodle class for the project. It seems like a > good way to do such a thing. > > http://crackrabbit.com/moodle/ > > I realize that I am probably not anyone's idea of a

Re: [Tutor] One of my 'baby step' programs

2006-10-01 Thread Luke Paireepinart
x27;s very simple, but I still like the fac tthat is does > something to user input. > you should look into the 'random' module. You can generate a random integer with the random.randint() function. Then us programmers who peek at your code can't cheat and choose 3 every

Re: [Tutor] My number-guessing program

2006-10-02 Thread Luke Paireepinart
e(1,11)) or random.choice([1,2,3,4,5,6,7,8,9,10]) Note that the random.randint function includes both endpoints (I.E. the numbers are 1-10 including 10) but the range() function doesn't include the last endpoint. HTH -Luke ___ Tutor mail

Re: [Tutor] Number guessing game

2006-10-02 Thread Luke Paireepinart
We'll also include the range to guess the numbers, just to add an extra feature, so we'll need min and max variables. 7. A goodbye string. We'll also need to use the random module to generate our guesses, so we don't always guess the same number. #start-code. #Number

Re: [Tutor] CGKit

2006-10-03 Thread Luke Paireepinart
> To install Py++ I downloaded it, and extracted it, next I > opened a windows command prompt and went to the corresponding directory, > then I typed "python setup.py install" this is supposed to install the > package? Because I only get a message from windows that states that to > install any

Re: [Tutor] Keycodes

2006-10-03 Thread Luke Paireepinart
Chris Hengge wrote: > Is it possible to capture keycodes for things like ctrl/alt/shift? > > I've made a script using msvcrt but it seems to skips most of the non > alphanumeric keys. > > Thanks. You can in Pygame. I don't know about msvcrt. > --

Re: [Tutor] save configuration of one application.

2006-10-03 Thread Luke Paireepinart
port Settings print Settings.color # Hope that makes sense. If you choose to go the latter route, keep in mind that modules are compiled to .pyc files upon importation, so you'll have to remove those anytime you modify config.py or the old code will be used instead. -Luke __

Re: [Tutor] Integer division Help requested

2006-10-03 Thread Luke Paireepinart
) -5.0 >>> math.floor(4.1) 4.0 The floor is the next lowest integer to the float. floor(-3.1) will be -4 floor(3.) will be 3 HTH, -Luke > > > > >

Re: [Tutor] Suggestions required on Gaming

2006-10-04 Thread Luke Paireepinart
games. Do you want it to be 3d, 2d? first-person, third-person, top-down, etc. The correct tool is the one which does the specific job best. We don't know what the job is so we can't help you choose a tool. -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Suggestions required on Gaming

2006-10-04 Thread Luke Paireepinart
Arun Kumar PG wrote: > Thanks Luke. > > I want to make a 3-D car race game between two players. And yes its > gonna be a networked game where each user will be using his/her own > PC and playing. If you want it to be 3d, you have a couple'o choices... Pygame with the PyopenG

Re: [Tutor] Help me with two dimensional arrays in Python

2006-10-04 Thread Luke Paireepinart
list being a full row, right? so... two_dimensional = [somelist,anotherlist] Or: two_dimensional = [ [1,2,3,4,5] , [6,7,8,9,10] ] This isn't a homework question, right? Good luck, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] revisiting struct and bytes again.

2006-10-04 Thread Luke Paireepinart
odule to convert. sorry I can't give more detail, I have to run, i'm late for class. -Luke > thanks > > sk > > > > __

Re: [Tutor] from string to variable name

2006-10-05 Thread Luke Paireepinart
ou just want to know if it's possible, I believe it is. But consider: if you don't know the variable name until runtime, how are you going to refer to the variable later in your code? It would be, insofar as I can tell, useless to do this. > -frank -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help me with two dimensional arrays in Python

2006-10-05 Thread Luke Paireepinart
p.append(1) else: tmp.append(tmp[y-1]) #this line would be different lst.append(tmp) That's the best I can do. HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] [Fwd: Re: from string to variable name]

2006-10-05 Thread Luke Paireepinart
OOPS, forwarding my reply to frank. I accidentally sent it straight to him. --- Begin Message --- frank h. wrote: why I am not using a dictionary: well I am lazy, I do not want to explicitly construct a dictionary :) You don't have to explicitly construct it. You can add stuff to it. If by exp

Re: [Tutor] Help: how to detect which key is pressed

2006-10-06 Thread Luke Paireepinart
on User Input, but the whole site. It will cover the most common questions that people new to Python have. Good Luck, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] embedding python

2006-10-08 Thread Luke Paireepinart
max . wrote: > hello i have a myspace and a blog both of wich allow me to input html and i > know a little html not much i can make a page with backround coler a title > words and pictures as well as links > > but i cant find any tutorials on embedding python useing html i found some > that use

Re: [Tutor] Help me with this Tkinter code

2006-10-10 Thread Luke Paireepinart
Asrarahmed Kadri wrote: > > > Folks, > > Just started to get my feet wet with basics of Tkinter Programming. > Here is a code which is giving me some problem; when I run it, it > displays me the button widget, but when I click it, the window doesn't > goes away. the program gets stuck up.

Re: [Tutor] not such file or directory exception

2006-10-11 Thread Luke Paireepinart
Alfonso wrote: > Trying to copy or move files -I do it with move or copyfile- between > directories, with characters of the spanish language gives me this > error: not such file or directory. I suppose this is related with > unicode, any idea how can I handle it? > Can you give us the code yo

Re: [Tutor] Why is random.choice so much slower than random.random()?

2006-10-12 Thread Luke Paireepinart
Dick Moores wrote: > Why is random.choice so much slower than random.random()? In fact, by > a factor of 12! And randint(). Some 25 times slower than random(). Why? > (I know that random() is the basis for most of the other functions in > the random module, and a look at random.py, though I don't

Re: [Tutor] Help with generating session id

2006-10-12 Thread Luke Paireepinart
? what is flup.middleware? what is flup.middleware.session? Your code doesn't do anything, does it? it's just a definition of a bunch of methods. Is this a library you wrote? What kind of advice are you looking to get from showing us this? HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] embedding lists in configuration files

2006-10-12 Thread Luke Paireepinart
ling seems to agree that you can't have multi-line strings. I don't know that for a fact, though. HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help me : Why this code is not working??

2006-10-12 Thread Luke Paireepinart
'quit', not 'exit' That's your first problem. The second problem you have, is that you're not calling this method, you're just accessing it, which doesn't really do anything. What you'll want to do is root.quit() and not root.quit HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Reading escaped characters from a file

2006-10-14 Thread Luke Paireepinart
David Heiser wrote: > > I have code that uses variables to hold escaped characters like "\n" > or "\03". As long as the assignment is done within the code, like > self.crChar = "\n", there is no problem. But When I try to read the > same character string from a text file and assign it, the str

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-15 Thread Luke Paireepinart
r every directory that we've changed into,    os.chdir('..') #go back to parent directory.I don't have a python interp installed on this computer, so there may be errors,and if so, I apologize in advance, but I can't see any reason why this wouldn't work.

Re: [Tutor] Get keyboard input while other program is in focus?

2006-10-16 Thread Luke Paireepinart
Jack wrote: > What commands can I use to have the program know a certain key has > been pressed while another program is in focus? > I think Pygame and TKInter have a capture-all-keys function, but this might also prevent the keypresses from actually going to the target application. > thanks,

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-16 Thread Luke Paireepinart
Chris Hengge wrote: > I chose the way I used the names because to me... > > outFile = open(aFile.lower(), 'w') # Open output buffer for writing. > = open a file with lowercase name for writing. > it is implied that aFile is from the zip, since it is created in the > loop to read the zip.. > > outF

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-16 Thread Luke Paireepinart
While car is the actual object > description, when I go to tell someone what I'm attempting to do with > the car, 'drive' is much more clear then car. Yeah, that makes sense, but I'm not really sure how it applies in this case. -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] [Fwd: Re: Tutor Digest, Vol 32, Issue 69]

2006-10-16 Thread Luke Paireepinart
OnSaveButton method in place of event.Skip(), but I think if you handwrote the code, you'd learn a lot of how wxPython works. I'm assuming you used Boa Constructor but if I'm wrong, I apologize. HTH, -Luke If you or someone could show me how to insert the save function into this

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-16 Thread Luke Paireepinart
Chris Hengge wrote: > Have you even read my code to see if you find it cryptic? I'm starting > to beleive people just read the one comment on possibly using better > naming conventions and assumed I had picked completely irrelivent names. Well, Chris, what can I say? We're busy people and we ge

Re: [Tutor] How to save text from a wxTextCtrl widget [was: Tutor Digest, Vol 32, Issue 70]

2006-10-16 Thread Luke Paireepinart
TextBox.GetValue()) #savefile.close() savefile = open('test.txt','w') #if you don't want 'test.txt' try using a variable. savefile.write(self.textCtrl1.GetValue()) #textCtrl1 is an attribute of your Frame1 class. savefile.close() #then we just save it. # Do you understand which parts of John's examples were changed and why? Hope That Helps, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-17 Thread Luke Paireepinart
fg','.sdr'] for zipFile in zFile.namelist(): if os.path.splitext(zipFile)[-1] in ext: outFile = os.path.split(zipFile)[-1] but that's just me :) I've gone back and read your code. The problem Kent was pointing out was that your for loop was iterating over a variable called aFile, and you were changing this variable during the loop. This is generally considered Bad Practice. That's all he meant. I think. HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help me abt this error

2006-10-17 Thread Luke Paireepinart
Asrarahmed Kadri wrote: > I am trying to write to a file, but I am getting this errror. > > IOError: (0, 'Error') > > Can someone explain what is it and whats the solution?? No. Give us the actual source and the full

Re: [Tutor] distribution

2006-10-17 Thread Luke Paireepinart
numpy(or don't use it.) Feel free to use TKInter, it's part of the python distribution (Unless they have pre-1.5 or something, in which case they should upgrade anyway !) :) HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help me abt this error

2006-10-17 Thread Luke Paireepinart
Oops, I replied off-list. Forwarding to list. --- Begin Message --- Mike Hansen wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luke Paireepinart Sent: Tuesday, October 17, 2006 11:50 AM To: Asrarahmed Kadri Cc: pythontutor Subject: Re

Re: [Tutor] Searching list items.

2006-10-17 Thread Luke Paireepinart
or use if 'astring' in line: if your use case is simple enough for that. show us what RE you used that gave you trouble. It's hard to help when we don't know where you're getting stuck :) > > Thanks. Sure. -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Searching list items.

2006-10-17 Thread Luke Paireepinart
lse has replied when I get back I'll look into it. Sorry I can't help right now. -Luke > > this printed out something like > > None > None > None > hex memory address of goodness > None > None ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help me abt this error

2006-10-17 Thread Luke Paireepinart
t able to do reads. you could use 'a+', but I don't recommend it. You'll probably run into weird behavior, and maybe only on certain inputs (I.E. scary bugs that you might not notice till your program is in use already.) HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] My apologyRe: Help me abt this error

2006-10-17 Thread Luke Paireepinart
deadline? Is it a school project or a work project? They expected you to learn Python and TKInter while you had a project looming over you? That's not a good way to go about it! Well, in any case, good luck. -Luke ___ Tutor maillist -

Re: [Tutor] Tutor Digest, Vol 32, Issue 72

2006-10-17 Thread Luke Paireepinart
tCtrl1.GetValue()) This line is a little complex. Let's break it up to make it easier to read. textBox = self.textCtrl1 even though self.textCtrl1 is a method of the current class instance (which is what self means) we can still assign a varia

Re: [Tutor] Searching list items.

2006-10-17 Thread Luke Paireepinart
substrs: if item in line: print line Whereas with a regular expression, you'd just do regexp = re.compile('something\d\d') then if regexp.search(line): print line Computationally the last example should be much more efficient. clearly it's also more complicated

Re: [Tutor] characters in python

2006-10-18 Thread Luke Paireepinart
Stanko wrote: > Can python handle this characters: ć, č, š, đ, ž? > If can, How? > Unicode strings. > And how to change tab spaceing in idle? I tried in idle properties. I > have set it to 4 character but it's still 8. > The default is 4. If it's 8, find out who changed it and ask them to ch

Re: [Tutor] Tutor Digest, Vol 32, Issue 72

2006-10-18 Thread Luke Paireepinart
>> I'm glad that you're not going to give up just yet! Don't worry, I >> have much more effort in store for you :) > [long and useful description of some basics of Python deleted] > > Wow, thanks very much! That was extremely useful. I had some time > late last night when it was quiet here an

Re: [Tutor] characters in python

2006-10-18 Thread Luke Paireepinart
Stanko wrote: > I tried with unicode strings, but nothing. It says : unsoported characters > Perhaps you could give us the code you were using? > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > >

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Luke Paireepinart
uot; % (item1, item2) Why even try to use the 'in' syntax if it's not working correctly? Maybe I still don't understand. -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Luke Paireepinart
Chris Hengge wrote: > Ok the example I gave here wasn't written as I had it in my head.. you > are right, the example only had 1 sentence. > > Inputs: > List1 ['a.exe','b.exe',c.exe'] > List2 ['A.exe',B.eXe',c.EXE'] > > for item in List1: > if item in List2: >print item + " " + li

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Luke Paireepinart
to my post so I can at least get confirmation that you received it, whether or not you read it. KTHXBYE. :) -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Best GUI toolkit?

2006-10-18 Thread Luke Paireepinart
ynchronising with vertical refresh etc). > Any advice much appreciated. > I'd say that it sounds like a job for Pygame, if you don't need actual GUI controls. I think if you used PyOpenGL + Pygame you could have vsync. pygame itself might have an option for this. Di

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Luke Paireepinart
Chris Hengge wrote: > Yes, I tried what you suggested, I've changed my looping structure to > this: > > count = 0 > for itemLine in lineList: > for itemDirectory in directoryList: > if itemLine == itemDirectory: > print match.ljust(20) + itemLine.ljust(2

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Luke Paireepinart
Chris Hengge wrote: > Well, if you refer to my thread where I mentioned that I had a screen > capture of the output.. I want it to look like that.. > > now it yells at me for everything that doens't match and does match. =D > > I dont think this test is working though, because using your suggested

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Luke Paireepinart
Chris Hengge wrote: > If that last post to Luke didn't clear anything up.. lets try this at > a smaller level... > I'm going to ignore the fact that my program already renames the file > properly.. > > I have list1 of filenames > I have list2 of filenames > &g

Re: [Tutor] Location of found item in list.

2006-10-19 Thread Luke Paireepinart
listing." % line Then you don't need the intermediate list of lowered items, and you don't have those really long indexing lines. But your way is fine :) Good luck on your future Python endeavours. -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Luke Paireepinart
Chris Hengge wrote: > I thought my solution was the easiest.. but I guess everyone skipped it =P No, we didn't skip it, but as we're all programmers here, we showed alternate ways that it could be done. Your post is the one that sparked the whole 'garbage collection' thing, you'll notice. Now, I

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Luke Paireepinart
't read the whole thing into ram, nor does it read line by line. It seeks to the end of the file (should be extremely fast) and reads backwards until it gets to a newline char. In other words: Very fast, and no extra ram usage. HTH, -Luke ___ Tutor maillis

Re: [Tutor] How to get the width of teh button widget..??

2006-10-20 Thread Luke Paireepinart
e-mail you seem to have forgotten to tell us what GUI package you're using! HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Best way to replace items in a list.

2006-10-20 Thread Luke Paireepinart
t know why you like the 'if item in ...' syntax so much ( ;) ), but you could do this with a loop pretty easily. #example for index,item in enumerate(lst): if item == 'Item To Replace': lst[index] = 'Replaced!' # HTH, -Luke > &g

Re: [Tutor] 5 questions

2006-10-22 Thread Luke Paireepinart
Kent Johnson wrote: > Alan Gauld wrote: > >> Pine Marten wrote: >> >>> 2. Is there list ettiquette one should be aware of? >>> >> Yes, but I'm not sure how you get a copy. >> Moderators??? >> > > Hmm, I didn't get that as part of my new moderator's welcome package. We > are pre

Re: [Tutor] GUI new project

2006-10-22 Thread Luke Paireepinart
ief=SUNKEN) > Because whitespace is important in python, you can't arbitrarily put newlines into your text. Your program is getting confused because it doesn't know what ', relief=SUNKEN)' means. Try putting a '\' before your newlines. Like: x = \ 'a'

Re: [Tutor] GUI new project

2006-10-22 Thread Luke Paireepinart
'listbox', cnf, kw) > File "D:\Python24\lib\lib-tk\Tkinter.py", line 1862, in __init__ > self.tk.call( > TclError: unknown option "-command" > > Any Ideas? > > self.lbSites = Listbox(self,command=sel

Re: [Tutor] GUI new project

2006-10-22 Thread Luke Paireepinart
johnf wrote: > On Sunday 22 October 2006 20:03, Luke Paireepinart wrote: > >>> """Create the Second ListBox""" >>> >>> self.lbRSSItems = Listbox(self, exportselection=0 >>>

Re: [Tutor] Evaluate my script?

2006-10-24 Thread Luke Paireepinart
> I would recommend using "from __future__ import division" at the top of your > script, so division behaves properly (3/2 == 1.5 instead of 1). This way you > don't have to make sure you write 3.0/2 everywhere you need to divide > something. > There's something to be said for your approach as we

Re: [Tutor] Evaluate my script?

2006-10-24 Thread Luke Paireepinart
Kent Johnson wrote: > Luke Paireepinart wrote: > >> so in Python 3000 there's no more integer division? >> I hope this is not the case. >> Sometimes it's the desired action, like when you repeatedly divide/mod a >> variable. >> >

Re: [Tutor] Self, Scopes and my unbelievable muddleheadedness.

2006-10-25 Thread Luke Paireepinart
ist.append(5) >>> a = [1,2,3,4] >>> append_five(a) >>> a [1, 2, 3, 4, 5] >>> append_five(a) >>> a [1, 2, 3, 4, 5, 5] Other than that, Maybe you think self is used for something other than what it's intended to be used for... but I

Re: [Tutor] Decimal truncation, rounding etc.

2006-10-25 Thread Luke Paireepinart
Joe Cox wrote: > My next project is to read a doc file and do some number editing. > I can alter numbers in the Interactive Shell OK: > > import math > print round(7.12345,4) > 7.1234 > > from decimal import* > Decimal('7.0').quantize(Decimal('1.000'),rounding = > decimal.ROUND_DOWN) > Dec

Re: [Tutor] Mailing list question

2006-10-26 Thread Luke Paireepinart
Jorge Azedo wrote: > Not so much a question about Python, but here goes: > > How do I reply to a specific thread in the mailing list? If I place > "Re:bla bla" in the subject line, I notice that I start a new thread, > I don't continue one that already exists. How do I go about doing this? >

Re: [Tutor] Fwd: Self, Scopes and my unbelievable muddleheadedness.

2006-10-26 Thread Luke Paireepinart
for each function in your class. You define the data once (probably in the initialization of your class) and then it's defined throughout that instance (as long as you pass the instance variable around). So the function reversePoem and readPoem didn't have to know how to get the data 'self.text' or 'self.title', it was just available to them. It could've gotten there from the __init__ method, or any other method of the class. Another example that might help, or might just confuse further: >>> class aClass(object): def __init__(self): self.variable = 'hello!' def printVariable(self): print self.variable >>> an_instance = aClass() >>> an_instance.printVariable() hello! >>> aClass.printVariable(an_instance) hello! If you understand this, you probably understand self. Hope that helps, reply with anything that doesn't make sense, or just to tell me that I wasted my time and didn't address any issues you actually had :) -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Mailing list question

2006-10-26 Thread Luke Paireepinart
>> > I'm trying to use the Reply All button on my mail client (I use > Thunderbird, by the way) like you guys suggested. Let's see if it > works :-P > That's what I use (Reply All and Thunderbird) and whenever I check my gmail account from the website, the messages I write appear threaded cor

Re: [Tutor] Mailing list question

2006-10-26 Thread Luke Paireepinart
ey only get the Tutor Digest and not every individual mail. Cheers, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Why is this only catching one occurance?

2006-10-26 Thread Luke Paireepinart
ving stuff from something you're iterating over! *slaps your fingers with a ruler* Make a copy of the list! HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Witch gui to choose for this script?

2006-10-27 Thread Luke Paireepinart
n case you want to see it. Good job on attaching the script! I did want to see it. I can't read the comments, though, but I think I got what it was doing. Good luck in whatever you choose to do. -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] move forward in arbitrary direction

2006-10-28 Thread Luke Paireepinart
ms like it would.Thanks,-Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] automatically add it to all the classes

2006-10-29 Thread Luke Paireepinart
anil maran wrote: > [some stuff] > > thanks > John Okay... So this is an e-mail from john... > [some other stuff] > > Anil And this is the reply by Anil? What is the question here, exactly? ___ Tutor maillist - Tutor@python.org http://mail.python.org/

<    1   2   3   4   5   6   7   8   9   >