Re: [Tutor] Hex conversion strangeness

2006-05-24 Thread John Fouhy
plays the result of every expression you type. In this case, the result of int('0x21', 16) is an integer, and python displays integers in base 10 by default --- hence, you see 33. By the way, you can enter integers in base 8 or base 16, if you want: >>> 0x21, 041 (33, 33) &g

Re: [Tutor] Calendar Module

2006-05-22 Thread John Fouhy
nt the output. For example: >>> s = 'Hello\n World!\n-\n --- \n - \n' >>> s 'Hello\n World!\n-\n --- \n - \n' >>> print s Hello World! - --- - >>> Or, you could try typing "p

Re: [Tutor] Nested list comprehensions

2006-05-14 Thread John Fouhy
0.240615497221 23 28657 0.365666586116 24 46368 0.827867508301 25 75025 2.14721368219 26 121393 4.08266218193 27 196418 20.1769099145 Hmm, do you know an easy way to check how much memory python is using? My HDD was swapping like crazy by the end of that.. -- John. ___

Re: [Tutor] Nested list comprehensions

2006-05-14 Thread John Fouhy
The python translation would be something like: fibs = [0, 1] + [ a+b for (a, b) in zip(fibs, fibs[1:])] But you can't quite do that in python :-) -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Treeview

2006-05-14 Thread John CORRY
1     print lookup   Technically this is the first solution that I have been able to post on the mailing list.  Does this mean I am improving?  Or does it not count as I have solved my own problem?   Regards,   John.   ___ Tutor mailli

[Tutor] Problems with Treeview

2006-05-13 Thread John CORRY
ack (most recent call last):   File "C:\Documents and Settings\Johnc\Projects\project7\shopcall.py", line 1 , in callback53     result = model.get_value(iter,0) TypeError: iter must be a GtkTreeIter   What do I need to assign to iter to make

Re: [Tutor] Python media player?

2006-05-08 Thread John Fouhy
ld be much clearer > in Python. pyMedia, maybe? I got that from the cheese shop (under the links menu at python.org): http://cheeseshop.python.org/pypi/PyMedia/1.2.3.0 See also http://cheeseshop.python.org/pypi?:action=browse&asdf=338. -- John. __

Re: [Tutor] trouble with re

2006-05-08 Thread Ertl, John
Kent, Thanks for the nock on the head, that has bitten me before. Taking out the spaces worked great. Thanks again, John Ertl -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Sent: Monday, May 08, 2006 10:53 AM Cc: tutor

[Tutor] trouble with re

2006-05-08 Thread Ertl, John
I have a file with 10,000 + lines and it has a coma delimited string on each line. The file should look like: DFRE,ship name,1234567 FGDE,ship 2, ,sdfsf The ,sdfsf line is bad data Some of the lines are messed up...I want to find all lines that do not end in a comma or seven digits and do som

Re: [Tutor] Button Signals

2006-05-07 Thread John CORRY
Liam,   Thanks for the prompt reply.  That is working for me.   Regards,   John,   -Original Message- From: Liam Clarke [mailto:[EMAIL PROTECTED] Sent: 07 May 2006 13:06 To: [EMAIL PROTECTED] Cc: tutor@python.org Subject: Re: [Tutor] Button Signals   Hi John, I&#x

[Tutor] Button Signals

2006-05-07 Thread John CORRY
assing in the tag returned by one of the signal connect methods, you can disconnect a signal handler. How do I find out what the integer tag is, so that I can put this in my code?   I have tried the pygtk faq page but it is currently unavailable.   Any help greatly appreciated.   Thanks,   Joh

[Tutor] Stumbled onto the answer!

2006-05-06 Thread John CORRY
store.append (["Wed"])     store.append (["Thu"])     store.append (["Fri"])     store.append (["Sat"])     store.append (["Sun"])        combo2.set_model(store)     combo2.set_text_column(0)     com

[Tutor] 2 Combo Boxes! What was I thinking?

2006-05-06 Thread John CORRY
ombo3.child.append_text(“Tue”)   The combobox3 is populated on the GUI but instead of being a drop down list it appears as a string on one line and looks like this: MonTue   I have to confess I am not really sure what I am doing.  I just guessed at putting the child command in.  It gets me close

[Tutor] Nested list comprehensions

2006-05-05 Thread John Clark
somone has a way of reading the nested list comprehension syntax that makes sense, I would appreciate it if you would share it. Thanks, -John ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] 2 Combo Boxes! What was I thinking?

2006-05-04 Thread John CORRY
ombo3.child.append_text(“Tue”)   The combobox3 is populated on the GUI but instead of being a drop down list it appears as a string on one line and looks like this: MonTue   I have to confess I am not really sure what I am doing.  I just guessed at putting the child command in.  It gets me close

Re: [Tutor] Halting execution

2006-05-03 Thread Ertl, John
I agree I should be a bit more careful about giving examples that are quick fixes as opposed to best practice. John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hugo González Monteverde Sent: Wednesday, May 03, 2006 12:05 PM To: tutor@python.o

Re: [Tutor] Halting execution

2006-05-03 Thread Ertl, John
Matthew, Not sure if ipython is different but have you tried sys.exit("stoping now") You could also put in a flag to turn the printing on and off so it wont print it out when you are testing. John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On

[Tutor] Books

2006-05-03 Thread John Connors
a book for my birthday. So I was wondering (bearing in mimd that I'm only 2 or 3 steps above total beginner), what is the one book on python that I shouldn't be without? John _ realestate.com.au: the biggest ad

Re: [Tutor] simple question about numeric types

2006-05-02 Thread John Fouhy
complex) Well, for one, you can simplify that line to: if isinstance(v, (int, float)): (also, you might want to check if it's a long as well --- ie: isinstance(v, (int, float, long))) Another possibility, maybe: try: int(v) except ValueError, TypeError: pass -- John. __

Re: [Tutor] question about run time

2006-05-02 Thread Ertl, John
odeAmount) print "Your memory usage is %s KB and your inode usage is %s" % (myUse.memTotal,myUse.inodeTotal) print "Your memory limit is %s KB and your inode limit is %s" % (myUse.memLimit, myUse.inodeLimit) if myUse.memLimit < myUse.memTotal or myUse.inodeLimit < m

Re: [Tutor] question about run time

2006-05-02 Thread Ertl, John
Kent, I will check with the systems guys...and the Perl guys down the hall to see if they have the same problem. Thanks for the help. John Ertl -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Sent: Tuesday, May 02, 2006 12:27 PM

Re: [Tutor] question about run time

2006-05-02 Thread Ertl, John
Kent, The files are very small (a few hundred lines). Maybe it is a network issue? But then why is it always slow the first time in the morning? I don't know network stuff but that seams a bit strange. Thanks, John Ertl -Original Message- From: Kent Johnson [mailto:[

[Tutor] question about run time

2006-05-02 Thread Ertl, John
with compiling but I am not sure. Any ideas how to speed this up? I am running python 2.4 on a RHE3.0 cluster. Thanks, John Ertl ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Silly Dice Game

2006-04-29 Thread John Connors
G'day John, >If I were you, I would look at separating more of my program out into >functions. Good use of functions will make your program more >readable, easier to debug, and easier to change, should the rules of >your dice game change :-) Yes, the rules change on a regular

Re: [Tutor] Silly Dice Game

2006-04-29 Thread John Fouhy
On 30/04/06, John Connors <[EMAIL PROTECTED]> wrote: > The wife and I play a silly dice game and I thought it would be a good > challange for me to write it as a program. No specific question, just > wondering if my technique is ok and is there anything that could be done > bet

[Tutor] Silly Dice Game

2006-04-29 Thread John Connors
gain != "y": break if dieLeft == 0: dieLeft = 6 print "\nYou used all the dice and must roll again" print "\n\nYour total score for that round was %d" % (totalScore) playAgain = raw_input("\nPlay again? (y/n) &quo

[Tutor] How Big Is Too Big?

2006-04-29 Thread John Connors
much? John _ New year, new job – there's more than 100,00 jobs at SEEK http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau&_t=752315885&_r=Jan05_tagline&_m=EXT ___

Re: [Tutor] how to *really* copy a list

2006-04-27 Thread John Fouhy
new list. eg: def mirror(seq): end = seq[:-1] end.reverse() return seq + end Finally, just a side comment: You can use slicing to reverse the end for you as well. So, we could rewrite the last function as: def mirror(seq): end = seq[-2::-1] return seq + en

Re: [Tutor] Alan Gauld's tut - namespaces

2006-04-26 Thread John Connors
understood that I couldn't understand the namespaces part of the tutorial. John _ Bounce Back from sickness and injury today. http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fclk%2Eatdmt%2Ecom%2FMOS%2Fgo%2Fnnmsngem001007mos

Re: [Tutor] Alan Gauld's tut - namespaces

2006-04-26 Thread John Connors
G'day Payal, I had trouble understanding the namespaces section of the tutorial too but it all clicked the other day when Alan explained the difference between import first and from first import * John >Hi, >In Alan's tutorial I haven't got the example of print42() ev

[Tutor] Checking in lists

2006-04-26 Thread John Connors
r because the second way does what I want but I would like to know why the first way doesn't work and if the syntax is wrong why doesn't it return an error. John PS I apologise if this is a duplicate, hotmail did some kind of spam check when I trie

Re: [Tutor] How to compile _tkinter in Fedora Core 4

2006-04-25 Thread John Connors
G'day John, There is a problem with a recent python update and fedora, if you go to http://forums.fedoraforum.org/ and do a search in the forum for tkinter and/or idle you will find the fix. I'm running Fedora Core 5 and found I had to install tkinter, I had to do a yum insta

[Tutor] How to compile _tkinter in Fedora Core 4

2006-04-25 Thread John Hsu
ected on linux2: test_tcl ... John Hsu ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Importing Modules

2006-04-24 Thread John Connors
G'day, I'm having trouble understanding the difference between, import sys and from sys import * It seems to me they both do the same thing. John _ New year, new job – there's more than 100,00 job

Re: [Tutor] Splitting a number into even- and odd- numbered digits

2006-04-19 Thread John Fouhy
gt; for c in s[::-2]: > ... odd = c + odd > ... > >>> String slicing will actually produce strings :-) eg: >>> s = '987654321' >>> s1, s2 = s[::-2], s[-2::-2] >>> s1 '13579' >>> s2 '2468' -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] My Name is John and I copy and paste

2006-04-18 Thread John CORRY
id = ? and finish_dro = ?', ( float(row[58]), row[0], float(row[2])))     c.execute('UPDATE cost_grid SET ie_rrp_19 = ? where cost_grid_id = ? and finish_dro = ?', ( float(row[59]), row[0], float(row[2])))     c.execute('UPDATE cost_grid SET cost_20 = ? where cost_grid_id = ? and finish_dro = ?', ( float(row[60]), row[0], float(row[2])))     c.execute('UPDATE cost_grid SET rrp_20 = ? where cost_grid_id = ? and finish_dro = ?', ( float(row[61]), row[0], float(row[2])))     c.execute('UPDATE cost_grid SET ie_rrp_20 = ? where cost_grid_id = ? and finish_dro = ?', ( float(row[62]), row[0], float(row[2])))         db.commit()     c.close()      Thanks,   John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] School Boy Error - Update

2006-04-16 Thread John CORRY
, '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0') Traceback (most recent call last):   File "C:\Python24\Lib\site-packages\databasemanager.py", line 35, in ?     c.execute(stat, sql_list) ProgrammingError: ('37000', 200, '[Microsoft][ODBC Visual FoxPro Driver]Syntax error.', 4347)   I assume this error is telling me that the database does not like the syntax of the data I am importing.  The data that I am importing is actually data that I exported, so I know that it is in the right order and the right amount.  The only thing that I can think of is that, the database requires floats for the numbers instead of strings.  I assume that the numbers in listy[0] are now strings.  Am I now going to have to throw listy[0] through a function to make the numbers into floats or is there another way to do this?   Am I on the right track?   Thanks,   John.   ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] School Boy Error

2006-04-16 Thread John CORRY
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,) Traceback (most recent call last):   File "C:\Python24\Lib\site-packages\databasemanager.py", line 31, in ?     c.execute(stat, sql_list) TypeError: parameters must be a list of tuples   Unfortunately sql_list gives the same error.   Thanks

[Tutor] School Boy error

2006-04-16 Thread John CORRY
#x27;, '0', '105', '182.9', '38.08', '83', '0', '117', '198.1', '41.42', '90', '0', '127', '223.5', '48.77', &#

[Tutor] School Boy Error

2006-04-15 Thread John CORRY
t; b = 91.4 a = 95.00   import mx.ODBC import mx.ODBC.Windows db = mx.ODBC.Windows.DriverConnect('DSN=vfp') c = db.cursor() c.execute(stat, listy[-1])    db.commit() c.close()   I get the following error:   TypeError: parameters must be a list

[Tutor] Didn't take long to hit my next wall!

2006-04-15 Thread John CORRY
? where cost_grid_id = ? and finish_dro = ?', ( a, c,b,))     db.commit() c.close()   Any suggestions would be greatly appreciated.   Thanks,   John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Good Hustle Hit the Showers!

2006-04-15 Thread John Corry
Hi, Good advice. I configured the ODBC data sources as advised and I am now able to query my database files. Thanks, John. -Original Message- From: Lloyd Kvam [mailto:[EMAIL PROTECTED] Sent: 15 April 2006 16:04 To: [EMAIL PROTECTED] Cc: Kent Johnson; Tutor Python Subject: Re: [Tutor

Re: [Tutor] odbc

2006-04-15 Thread John Corry
this what I need to log onto with python first before I access the database file? Regards, John. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Kent Johnson Sent: 15 April 2006 15:40 Cc: tutor@python.org Subject: Re: [Tutor] odbc John CORRY wrote: >

[Tutor] odbc

2006-04-15 Thread John CORRY
t][ODBC Driver Manager] Data source name not found and no default driver specified', 6044)     It gives me the same error that I am experiencing when I run my code.  Does this mean that I have not installed something that I need or have not installed

Re: [Tutor] Difficulty connecting with odbc drivers

2006-04-15 Thread John Corry
Liam, Thanks for the quick response. I have changed the code so that dsn is now DSN. However I get the same error. Any other thoughts? Regards, John. -Original Message- From: Liam Clarke [mailto:[EMAIL PROTECTED] Sent: 15 April 2006 15:02 To: [EMAIL PROTECTED] Cc: tutor@python.org

[Tutor] Difficulty connecting with odbc drivers

2006-04-15 Thread John CORRY
d.dbf') OperationalError: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified', 6044)   What am I doing wrong and what do I need to do?  Any help would be greatly appreciated.   Thanks,   John.  

[Tutor] Difficulty connecting with odbc drivers

2006-04-15 Thread John CORRY
d.dbf') OperationalError: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified', 6044)   What am I doing wrong and what do I need to do?  Any help would be greatly appreciated.   Thanks,   John.  

Re: [Tutor] MySQLdb question

2006-04-14 Thread Allen John Schmidt, Jr.
Patty wrote: >I have a data structure in a python file that looks something like this: > >my_map= { "host1": {"target1", "target2", "target3" }, > "host2": {"target4", "target5", "target6" }, > } > >cursor.execute("""SELECT %s FROM targets >WHERE target_name = %s """ %

[Tutor] Databases

2006-04-13 Thread John Corry
knowledge with databses. I have created and modified some gadfly databases but on a very simple level. Any help would be greatly appreciated. Thanks, John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Can anyone help me plz

2006-04-13 Thread John Brokaw
I'am very new to pygame, and python and any help would help me so much thx. I have no idea whats wrong the chimp.py ex. works perfect, but when I get to http://rene.f0o.com/mywiki/LECTURETHREE, I get so stuck becuz the call window = pygame.display.set_mode((468, 60)) makes a window like it should

Re: [Tutor] Extending a list within a list comprehension

2006-04-11 Thread John Fouhy
lements] dec.sort() elements = [x[1] for x in dec] -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Question about list

2006-04-10 Thread John Fouhy
ple, list)): print len(item) else: print 1 May I ask why you're doing this? This feels like a situation where you need to think clearly what your goals are before you go diving towards a solution :-) -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Space the final frontier

2006-04-05 Thread John Corry
ne) y = line x = "\n" z = y + x input2.write(z) del input del input2 Thanks again, John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Space the final frontier!

2006-04-04 Thread John Corry
,dial= 028 90 79 0154, dial= ['002, borfiled, dial= 02890 618521, dial=\n'] 002, borfiled, dial= 02890 618521, dial= 002, borfiled, dial= 02890 618521, dial= ['003, newcomp, dial=02890419689, dial='] 003, newcomp, dial=02890419689, dial= 003, new

Re: [Tutor] file?

2006-04-03 Thread John Fouhy
does not exist!' sys.exit() ziparchive = zipfile.ZipFile(inputfilename, 'r') # ... -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Newbie: Passing variable into re.compile

2006-03-29 Thread John Fouhy
On 30/03/06, Jerome Jabson <[EMAIL PROTECTED]> wrote: > import re > > arg1 = '10" > > p = re.compile(r + arg1 + '\.(\d+\.\d+\.\d+)') Have a look at string substitutions :-) --- http://docs.python.org/lib/typesseq-strings.html p = re.compil

Re: [Tutor] Program for outputing the letter backward

2006-03-28 Thread John Fouhy
On 29/03/06, Hoffmann <[EMAIL PROTECTED]> wrote: > Hi John, > > (1) vehicle[index] is: 'c' > (2) If index = index = 1, so vehicle[index] becomes: > 'a' What I'm getting at here is that, by changing index, we can change which letter we are lookin

Re: [Tutor] Program for outputing the letter backward

2006-03-28 Thread John Fouhy
... print letter > ... last -= 1 > ... What is vehicle[index] ? What if I change index, say, index = index + 1 Now what is vehicle[index] ? -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Bigrams and nested dictionaries

2006-03-28 Thread John Fouhy
} >>> D['d'] = {'a':7, 'b':0} >>> D['d']['c'] = 1 >>> D {'d': {'a': 7, 'c': 1, 'b': 0}} Are you sure you haven't mistakenly assigned something other than a dict to D or D['d'] ? -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Program for outputing the letter backward

2006-03-28 Thread John Fouhy
e exactly three letters long. Can you see how to write a loop to produe this output? Hint: the len() function will tell you how long a string is. eg: if vehicle == 'car' then len(vehicle) == 3. -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python tutor

2006-03-28 Thread John Lesko
This actually sounds like very good idea. I have not heard of it before, but I think it would be a very good way to learn. Let me know if you find anything.JohnOn 3/28/06, Noufal Ibrahim <[EMAIL PROTECTED]> wrote: Greetings all,   Are there any programs for python that offer an "interactive" tutor

Re: [Tutor] Data Type with Dictionary and List Behavior

2006-03-27 Thread John Fouhy
return self.keys def setDefault(self, key): self.default = key HTH! -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] compilte python to an executable file.

2006-03-26 Thread John Fouhy
the flies needed to make it go. It still means you can run your programs on Windows systems without python installed, though. -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Practice tomorrow

2006-03-23 Thread John Fouhy
On 24/03/06, Naomi Guyer <[EMAIL PROTECTED]> wrote: > Till just before 1pm would be good. That way I can make the practice at > Martin Luckie at 1pm. As a lifetime member of the Vic flying disc club, I can write you a note excusing you from being late if you like

Re: [Tutor] Renaming computers

2006-03-23 Thread John Fouhy
y of sample python scripts for automating WIndows: http://www.microsoft.com/technet/scriptcenter/scripts/python/default.mspx There may be something helpful there.. -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Alternative to nested loops

2006-03-19 Thread John Fouhy
use a generator expression (requires Python 2.4): >>> sum(x for y in foo for x in y) 45 This will be slightly faster, depending on how big your list is. But really, there are times when clarity and efficiency both come together and say "Write explicit for loops" :-) -- John. ___

[Tutor] what tools will i need to start my project ?

2006-03-19 Thread John
i'm new to programming and decided to go with python as my first language. my goal is to create an excel macros that will grab information from an html file and import it into my worksheet. I figure i should first start apart from excel then work on making it work with it (if it is even pos

[Tutor] Help with re.sub()

2006-03-16 Thread John Clark
Hi, I have a file that is a long list of records (roughly) in the format [EMAIL PROTECTED] So, for example: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] What I would like to do is run a regular expression against this and wind up with: [EMAIL

Re: [Tutor] Simulate Input from mouse and keyboard?

2006-03-15 Thread John Fouhy
playback engine! Pamie allows you to automate I.E. by manipulating I.E.'s Document Object Model via COM. This Free tool is for use by Quality Assurance Engineers and Developers. """ -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tix: binding

2006-03-15 Thread John Fouhy
if the mouse is within the button, and then activate your callback. Something else you could try (which I haven't tested) --- instead of box.cancel.bind, do box.cancel.config(command= ...). -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

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

2006-03-14 Thread John Fouhy
didas handball shoes. Expect to pay $200 or more, though. -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

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] [OT] Shells

2006-03-06 Thread John Fouhy
including Perl, Python, (ba)sh, and SQL, so the syntax sometimes seems to fight itself. But, overall, I'm very impressed. It looks a lot like the python interpreter, except customised to focus on file manipulation and process management (since that's what s

Re: [Tutor] Tutorial for creating web server

2006-03-02 Thread John Fouhy
mpleHTTPServer, again both in the standard library. I've never used them, but it seems like they will drastically simplify the task of making a web server. -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] list packing

2006-02-26 Thread John Fouhy
/snd/') if f.endswith('.aif')] Or, slightly more robustly (?), snd = [os.path.join('/Users/kevin/snd', f) for f in os.listdir('/Users/kevin/snd/') if f.endswith('.aif')] -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Grepping a file for words in a list

2006-02-24 Thread John Purser
On Fri, 24 Feb 2006 12:23:22 -0800 (PST) Danny Yoo <[EMAIL PROTECTED]> wrote: > > > On Fri, 24 Feb 2006, John Purser wrote: > > > I'm writing a system admin script in python that checks recently > > accessed files for keywords like "failed, denied, err

[Tutor] Grepping a file for words in a list

2006-02-24 Thread John Purser
Hello, I'm writing a system admin script in python that checks recently accessed files for keywords like "failed, denied, error,..." etc. I'm using popen to call grep -F but it's VERY slow. Can anyone suggest a faster method to do this? Thanks, John Purse

Re: [Tutor] Repeating a routine

2006-02-22 Thread John Connors
who assist in here. Sorry if I've done the wrong thing. John _ Search for local singles online @ Lavalife - Click here http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthr

Re: [Tutor] Repeating a routine

2006-02-22 Thread John Connors
G'day, I think my peanut sized brain is starting to understand how to do this. I tried with a simple dice game where 4 dice are rolled, if the total of the last 2 dice rolled is 6 you win. It's kinda pointless using 4 dice rolls when only 2 are needed but I wanted to prove to myself I could cal

Re: [Tutor] First Try 1.2

2006-02-22 Thread John Connors
better at reading the code. Very good point. I have to go away for 3 weeks in a couple of days and I was trying to leave helpful hints to myself in the code so I won't forget what I have learnt. But you are right, I got carried away and most were just

[Tutor] Repeating a routine

2006-02-22 Thread John Connors
, bad habits but I'm starting to miss them. John _ New year, new job – there's more than 100,00 jobs at SEEK http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau&_t

Re: [Tutor] First Try 1.2

2006-02-22 Thread John Connors
number_of_balls +1), 1) print '%3s\t%s \tPower Ball: %s\n' % (game, lotto_numbers, pwrball) save_numbers = 'Game: %3s\t%s \tPower Ball: %s\n' % (game, lotto_numbers, pwrball) f.write(save_numbers) print '\nHope you win!' f.write('\nH

Re: [Tutor] Translator

2006-02-21 Thread John Fouhy
se (appropriately enough) a dictionary. You can read about dictionaries in the tutorial here: http://docs.python.org/tut/node7.html#SECTION00750 If you want to do genuine translation, like English to French or something, then, well, ask someone who works at Go

[Tutor] First Try 1.2

2006-02-21 Thread John Connors
#x27;a').write('Game: ') file('/home/mutt/lotto.txt','a').write(str(game)) file('/home/mutt/lotto.txt','a').write('') file('/home/mutt/lotto.txt','a').write(str(lotto_numbers)) file('/home/mutt/lo

[Tutor] First Try 1.1

2006-02-20 Thread John Connors
le('/home/mutt/lotto.txt','a').write('') file('/home/mutt/lotto.txt','a').write(str(lotto_numbers)) file('/home/mutt/lotto.txt','a').write('\n') print '\nHope you win!' file('/home/mutt/lotto.tx

Re: [Tutor] simple list question

2006-02-20 Thread John Fouhy
On 21/02/06, John Fouhy <[EMAIL PROTECTED]> wrote: > Have you looked at QHack? Oops, I forgot the link: http://adom.de/misc/qhack.php3 -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] simple list question

2006-02-20 Thread John Fouhy
a minimal roguelike, intended to show how to get started. Written by Thomas Biskup (of ADOM fame). It might give you an idea of the kind of data structures you might be able to use to represent the map. -- John. ___ Tutor maillist - Tutor@python.org ht

Re: [Tutor] simple list question

2006-02-20 Thread John Fouhy
>>> def p(): ... print 'foo' ... print 'bar' ... print 'baz' ... >>> def q(): ... print 'foo', ... print 'bar', ... print 'baz' ... >>> p() foo bar baz >>> q() foo bar baz As to formatting your list

Re: [Tutor] How can I make Python Shell see new version offunctionsubroutine?

2006-02-19 Thread John Fouhy
On 20/02/06, Kermit Rose <[EMAIL PROTECTED]> wrote: > >>> import factor30.py > > Traceback (most recent call last): > File "", line 1, in -toplevel- > import factor30.py > ImportError: No module named factor30.py Because the module is named

Re: [Tutor] Generating small random integer

2006-02-19 Thread John Fouhy
hat randint is in the random module. ie, instead of calling randint(), call random.randint(). Have you been through the tutorial on python.org? It is quite helpful. -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How can I make Python Shell see new version of function subroutine?

2006-02-19 Thread John Fouhy
hing short of closing the shell and re-opening it that I can do > to fix this? Have you tried restarting IDLE? The first thing to do would be to verify that the problem is what you think it is (as opposed to a bug in your code, for example). -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Bug in python

2006-02-19 Thread John Fouhy
d a function definition with an extra carriage return. (at least, that's the way it works in the console version) eg: >>> def foo(): ... pass ... def bar(): File "", line 3 def bar(): ^ SyntaxError: invalid syntax

[Tutor] First Try

2006-02-19 Thread John Connors
random numbers between 1 and 44 inclusive print games, lotto print else: print print "Hope you win!" I know this is a very simple program but... could I have done this a better way? John _ Search for loca

Re: [Tutor] G'day

2006-02-18 Thread John Connors
round to printing it out sooner or latter (when the Mrs isn't here so she won't complain about me wasting ink and paper). John _ realestate.com.au: the biggest address in property http://ninemsn.realestate.com.au

Re: [Tutor] G'day

2006-02-16 Thread John Fouhy
On 16/02/06, John Connors <[EMAIL PROTECTED]> wrote: > My 1st dumb question: I have a copy of Teach Yourself Python in 24 Hours, > printed in 2000 so I guess it's virtually usless but i was hoping to learn > some of the basics from it. There is a small bit of code near the &

[Tutor] G'day

2006-02-15 Thread John Connors
G'day, I'm new to Python and new to the list and just thought I'd say a quick hello before asking my 1st dumb question. My name is John and I live in Australia, I've been using computers since about 1983. I haven't done any programming since the commodore 64 basic days

[Tutor] Gadfly Database Problems

2006-02-14 Thread John Corry
database files. I can see the database files in the dist folder. Are there other files which I have to manually copy into the dist folder such as the sql_mar.py? Any help or pointers would be greatly appreciated. I know that this is a py2exe specific question but I have

Re: [Tutor] Tkinter, widgets not displaying...

2006-02-09 Thread John Fouhy
programming with a GUI, one good way is to use .after_idle. ie, instead of myturns.insert(str(i)), do top.after_idle(myturns.insert, str(i)) (I think this is the right syntax). This will cause the mainloop thread to run the code instead. HTH! -- John. _

Re: [Tutor] Splitting long string into same len parts

2006-02-08 Thread John Fouhy
, for instance: >>> n = 'xb1jyzqnd1eenkokqnhep6vp692qi9tmag3owzqw0sdq3zjf' >>> n[0:3], n[3:6] ('xb1', 'jyz') Can you see how to generate the slice boundaries for the length you need? -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] soundfile picker & rating system

2006-02-08 Thread John Fouhy
song ranked 50 will be fifty times more likely to be chosen than a song ranked 1, while a song ranked 80 will be only 1.6 times more likely to be chosen than a song ranked 50. Maybe some kind of logarithmic transform might smooth things out a bit..? -- John. __

<    3   4   5   6   7   8   9   10   11   >