Re: [Tutor] SQLite3 DB Field Alphabetizing

2010-10-12 Thread David Hutto
> > Did you include an ORDER BY? See three posts above, line 6. > > > -- > Alan Gauld > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > > > ___ > Tutor maillist  -  tu...@python.org > To unsubscribe or change subscription options: >

Re: [Tutor] SQLite3 DB Field Alphabetizing

2010-10-12 Thread David Hutto
On Tue, Oct 12, 2010 at 10:23 AM, Alan Gauld wrote: > > "David Hutto" wrote > >> > Did you include an ORDER BY? >> >> See three posts above, line 6. > > Looks like our posts crossed in transit :-) > > So you order by graphname, and you only h

Re: [Tutor] SQLite3 DB Field Alphabetizing

2010-10-12 Thread David Hutto
Quick note: forgot to add that the initial db file is setup with the following: import sqlite3 as lite class db(object): def onNewProjSQLDB(self): self.con = lite.connect('/home/david/pythonfiles/pythonscripts/roughdraftapps/dataplot3/db/dpdb.db')

Re: [Tutor] SQLite3 DB Field Alphabetizing

2010-10-13 Thread David Hutto
On Wed, Oct 13, 2010 at 8:17 AM, Joel Goldstick wrote: > > > On Wed, Oct 13, 2010 at 4:01 AM, Alan Gauld > wrote: >> >> "David Hutto" wrote >> >>> Below is the output before converting: >>> >>> [(u'.hjvkjgfkj/bdgfkjbg&#

Re: [Tutor] SQLite3 DB Field Alphabetizing

2010-10-13 Thread David Hutto
On Wed, Oct 13, 2010 at 9:27 AM, Steven D'Aprano wrote: > On Thu, 14 Oct 2010 12:13:50 am David Hutto wrote: >> I see it now. I knew that the u outside ' ' is the coding for the >> string, but I thought I had to strip it before using it since that >> was how i

[Tutor] Converting from unicode to nonstring

2010-10-14 Thread David Hutto
self.bgcolor = line[3] self.plot = line[4] self.grid = line[5] self.x_y_axis_range = line[6] I get the error: ValueError: invalid literal for float(): 1,2,3,4 So my question is, how do I convert the unicode '' to a plain n

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread David Hutto
On Thu, Oct 14, 2010 at 10:14 AM, David Hutto wrote: > Hey Buddy Pals, > > I receive the following output from a sqlite db > > (u'graph1', u'Line', u'222', u'BLUE', u'1,2,3,4', u'True', u'0,5,0,10') > >

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread David Hutto
On Thu, Oct 14, 2010 at 11:16 AM, David Hutto wrote: > On Thu, Oct 14, 2010 at 10:14 AM, David Hutto wrote: >> Hey Buddy Pals, >> >> I receive the following output from a sqlite db >> >> (u'graph1', u'Line', u'222', u'BLUE&#

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread David Hutto
On Thu, Oct 14, 2010 at 2:19 PM, Sander Sweers wrote: > On 14 October 2010 16:14, David Hutto wrote: >> (u'graph1', u'Line', u'222', u'BLUE', u'1,2,3,4', u'True', u'0,5,0,10') >> >> Which is a tuple of un

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread David Hutto
On Thu, Oct 14, 2010 at 2:58 PM, Adam Bark wrote: > On 14/10/10 19:29, David Hutto wrote: >> >> On Thu, Oct 14, 2010 at 2:19 PM, Sander Sweers >>  wrote: >> >>> >>> On 14 October 2010 16:14, David Hutto  wrote: >>> >>>> >>

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread David Hutto
On Thu, Oct 14, 2010 at 3:02 PM, Sander Sweers wrote: > On 14 October 2010 20:29, David Hutto wrote: >> Actually, I needed it to be converted to something without a string >> attached to it. See a post above, and it was fixed by eval(), > > Using eval is a big security risk

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread David Hutto
On Thu, Oct 14, 2010 at 3:24 PM, Adam Bark wrote: > On 14/10/10 20:21, David Hutto wrote: >> >> On Thu, Oct 14, 2010 at 2:58 PM, Adam Bark  wrote: >> >>> >>>> Actually, I needed it to be converted to something without a string >>>> atta

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread David Hutto
On Thu, Oct 14, 2010 at 3:31 PM, David Hutto wrote: > On Thu, Oct 14, 2010 at 3:24 PM, Adam Bark wrote: >> On 14/10/10 20:21, David Hutto wrote: >>> >>> On Thu, Oct 14, 2010 at 2:58 PM, Adam Bark  wrote: >>> >>>> >>>>> Actu

Re: [Tutor] Converting from unicode to nonstring

2010-10-15 Thread David Hutto
27;field' when replacing a variable so that self.plot = [1,2,3,4] instead of self.plot = u'[1,2,3,4]' Let me know, meanwhile I'll be reviewing the replies more thoroughly, now that I've had a nap. Thanks, David _

Re: [Tutor] Converting from unicode to nonstring

2010-10-15 Thread David Hutto
On Thu, Oct 14, 2010 at 3:02 PM, Sander Sweers wrote: > On 14 October 2010 20:29, David Hutto wrote: >> Actually, I needed it to be converted to something without a string >> attached to it. See a post above, and it was fixed by eval(), > > Using eval is a big security risk

Re: [Tutor] Converting from unicode to nonstring

2010-10-15 Thread David Hutto
On Thu, Oct 14, 2010 at 2:58 PM, Adam Bark wrote: > On 14/10/10 19:29, David Hutto wrote: >> >> On Thu, Oct 14, 2010 at 2:19 PM, Sander Sweers >>  wrote: >> >>> >>> On 14 October 2010 16:14, David Hutto  wrote: >>> >>>> >>

Re: [Tutor] Converting from unicode to nonstring

2010-10-15 Thread David Hutto
> In which case the code Sanders sent you is a much more sensible way of > recovering your data. Evalling the string u'plot' still doesn't make much > sense to me though. But it's the only thing working correctly though, so until I have a better solution, I'm forced to deal with any bugs in interp

Re: [Tutor] Converting from unicode to nonstring

2010-10-15 Thread David Hutto
On Thu, Oct 14, 2010 at 6:56 PM, Alan Gauld wrote: > > "David Hutto" wrote > >> In other words I needed (1,2,3,4) not u'(1,2,3,4)' to be inserted >> for variable self.plot > > You appear to be making this much more difficult than it needs to be.

Re: [Tutor] Converting from unicode to nonstring

2010-10-15 Thread David Hutto
On Thu, Oct 14, 2010 at 7:00 PM, Alan Gauld wrote: > > "David Hutto" wrote > >> it's not necessary to worry about insertion of data other than my own >> inputs. > > But can you be sure that you won't accidentally mistype something > that e

Re: [Tutor] Converting from unicode to nonstring

2010-10-15 Thread David Hutto
On Thu, Oct 14, 2010 at 10:09 PM, Steven D'Aprano wrote: > On Fri, 15 Oct 2010 04:43:46 am David Hutto wrote: > >> Fixed with: >> >> self.lines = self.newplot.plot(eval(self.plot)) > > Anytime you use eval, chances are that it isn't fixed at all, but j

Re: [Tutor] Moving my C++ code to Python?

2010-10-15 Thread David Hutto
This isn't an answer to your question, but I'm doing about the same in reverse(it sounds like) as you're doing. More directly just processing data for 2-d/3d graphs using matplotlib and wxpython. So, I was wondering if you think it's similar to those ends, and good enough to let someone else look a

Re: [Tutor] Moving my C++ code to Python?

2010-10-16 Thread David Hutto
On Fri, Oct 15, 2010 at 6:39 PM, Paul wrote: > On Fri, Oct 15, 2010 at 3:07 PM, David Hutto wrote: >> This isn't an answer to your question, but I'm doing about the same in >> reverse(it sounds like) as you're doing. More directly just processing >> data fo

Re: [Tutor] High Low Game

2010-10-18 Thread David Hutto
On Mon, Oct 18, 2010 at 6:34 PM, Raquel wrote: > Hi, > I am new to Python, and have hit a WALL.  Any help is appreciated!   Below > is what I have so far, for the "High Low Game"...when I try to run it, > nothing happens, so I have been unable to finish it.  I am sure it is > something simple... >

Re: [Tutor] High Low Game

2010-10-18 Thread David Hutto
More importantly, outside the function it calls. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What does "TypeError: 'int' object is not iterable" mean?

2010-10-22 Thread David Hutto
On Fri, Oct 22, 2010 at 9:42 AM, Richard D. Moores wrote: > On Thu, Oct 21, 2010 at 15:44, Richard D. Moores wrote: >>> If you want to control the number of decimal places in the string >>> formatting do something like: >>> >> i = 3 >> print ("NEW LOW: %%.%sf at %%s" % i) % (lowz, timesta

Re: [Tutor] What does "TypeError: 'int' object is not iterable" mean?

2010-10-22 Thread David Hutto
On Fri, Oct 22, 2010 at 9:55 AM, Richard D. Moores wrote: > On Fri, Oct 22, 2010 at 06:47, David Hutto wrote: >>> which works fine, but a question remains: n is an integer. Why the 's' >>> in '%sf'? >> >> Right here: >> http://docs.p

Re: [Tutor] What does "TypeError: 'int' object is not iterable" mean?

2010-10-22 Thread David Hutto
If I understand what i just said correctly, it just means it tells the string what type to convert from when placing it into the final result. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/ma

Re: [Tutor] Syntax Error Messages

2010-10-22 Thread David Hutto
What my buddy pal is saying, is that you should start at the beginning. I first downloaded x version of python to x operating system, then I tried this tutorial with these explicit modules/requirements(which I may or not have) then progress to the smaller aspects, like this won't iterate, or that d

[Tutor] Building input for a function call

2010-11-12 Thread David Hutto
lf.oblist = self.canvas.find_withtag('object') print self.oblist self.list = [] for item in self.oblist: self.itemname = self.canvas.gettags(item) if self.itemname[1] != 'default&

Re: [Tutor] List comprehension question

2010-11-12 Thread David Hutto
>        repeatedly, returning a list of results. ... > > I'm sorry, Steven, but I could you revise this code to use repeat=5 > instead of the for loop? I can't see how to do it. >>> help(timeit.Timer repeat(self, repeat=3, number=100) | Call timeit() a few times. | | This is a

Re: [Tutor] Building input for a function call

2010-11-12 Thread David Hutto
Apologies, forgot to add I'm using 2.6.4 on ubuntu 9.10 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] List comprehension question

2010-11-12 Thread David Hutto
Apologies, missed that part. Didn't mean to seem rude. import timeit def anyName(): pass for num in range(10): t = timeit.Timer('anyName()','from __main__ import anyName') print t.repeat(repeat=5) #or import timeit def anyName(): pass t = timeit.Timer('anyNa

Re: [Tutor] Building input for a function call

2010-11-12 Thread David Hutto
This is a more precise question, the above was after trying different methods, and it got a little confusing. Why in the below does using in line 12:self.objectsvars = 'menuitemhere','menuitemhere','menuitemhere','menuitemhere', not work, but placing 'menuitemhere','menuitemhere','menuitemhere','m

Re: [Tutor] 'pydoc' is not recognized as an internal or external command, ...

2010-11-12 Thread David Hutto
For what you're looking for you could use: >>>help(raw_input) In the python terminal,meaning type python first. For pydoc on ubuntu in the command line, pydoc -p 1234 and then take your browser to http://localhost:1234, you might need to select the work offline mode. On windows IIRC it's abou

Re: [Tutor] Building input for a function call

2010-11-12 Thread David Hutto
canvas.gettags(item) if self.itemname[1] != 'default': self.list.append(self.itemname[1]) print self.list self.objectsvars = str(self.list).strip('[]') print self.objectsvars

Re: [Tutor] Building input for a function call

2010-11-12 Thread David Hutto
itemname[1] != 'default': self.list.append(self.itemname[1]) self.objectsvars = str(self.list).strip('[]') self.var = StringVar(self.root) self.var.set(self.objectsvars[0]) self.f1 =

Re: [Tutor] Grabbing Information from txt files

2010-11-12 Thread David Hutto
On Fri, Nov 12, 2010 at 9:43 PM, Michael Stover wrote: > My apologies for my last email, admittedly I was more tired that I thought > as after re-reading it and the emails coming in, I found that I did not > provided "proper" information. > > 1. I have a script that is detecting multiple various b

Re: [Tutor] (no subject)

2009-04-06 Thread David Duncan
On Mon, Apr 6, 2009 at 8:29 PM, David wrote: > Sifis Sifakis wrote: >> >> Hi, >> I'm a student in Applied Informatics and i need to make a project in >> Python. More specificaly,i have to create a simple online bookstore using >> Python. >

[Tutor] Regex for a variable within a string

2009-04-08 Thread David Cash
Hi, I'm new to python and have decided to develop a web crawler / file downloader as my first application. I am at the stage where the script requests a page and parses the page for URLs, then prints them out. However, I'd like to change my current regex that greps for 'http' to one that will grep

[Tutor] Lists in a file

2009-04-26 Thread David Holland
()             for line in lines:     print line     print line[0]       text_file.close() And an example of the type of text :- ['a','b','c'] ['e','d','f'] Any ideas? Thanks in advance David Holland

Re: [Tutor] Lists in a file

2009-04-27 Thread David Holland
Thanks for all the suggestions.  I will have to try this. --- On Sun, 26/4/09, Kent Johnson wrote: From: Kent Johnson Subject: Re: [Tutor] Lists in a file To: "Robert Berman" Cc: "David Holland" , "tutor python" Date: Sunday, 26 April, 2009, 8:04 PM On Sun, A

Re: [Tutor] Replacement for __del__

2009-05-19 Thread David Stanek
rces that you want to clean up could have already been garbage collected. To protect against this I see people doing things like:: def __del__(self): try: self.f.close() except: pass To me this is just silly. -- David blog: http://www.traceback.org twitter: http://t

[Tutor] Urllib, mechanize, beautifulsoup, lxml do not compute (for me)!

2009-07-06 Thread David Kim
Hello all, I have two questions I'm hoping someone will have the patience to answer as an act of mercy. I. How to get past a Terms of Service page? I've just started learning python (have never done any programming prior) and am trying to figure out how to open or download a website to scrape da

Re: [Tutor] Urllib, mechanize, beautifulsoup, lxml do not compute (for me)!

2009-07-07 Thread David Kim
On Tue, Jul 7, 2009 at 7:26 AM, Kent Johnson wrote: > > curl works because it ignores the redirect to the ToS page, and the > site is (astoundingly) dumb enough to serve the content with the > redirect. You could make urllib2 behave the same way by defining a 302 > handler that does nothing. Many

Re: [Tutor] Urllib, mechanize, beautifulsoup, lxml do not compute (for me)!

2009-07-07 Thread David Kim
Thanks Kent, perhaps I'll cool the Python jets and move on to HTTP and HTML. I was hoping it would be something I could just pick up along the way, looks like I was wrong. dk On Tue, Jul 7, 2009 at 1:56 PM, Kent Johnson wrote: > On Tue, Jul 7, 2009 at 1:20 PM, David Kim wrote: >>

[Tutor] building database with sqlite3 and matplotlib

2009-08-07 Thread David Kim
Hello everyone, I've been learning python in a vacuum for the past few months and I was wondering whether anyone would be willing to take a look at some code? I've been messing around with sqlite and matplotlib, but I couldn't get all the string substitution (using ?s). I ended up getting the scri

Re: [Tutor] building database with sqlite3 and matplotlib

2009-08-08 Thread David Kim
Thanks so much for the comments! I appreciate the look. It's hard to know what the best practices are (or if they even exist). On Sat, Aug 8, 2009 at 2:28 PM, Kent Johnson wrote: > > You don't seem to actually have a main(). Are you running this by importing > it? > > I would make a separate func

[Tutor] Automating creation of presentation slides?

2009-08-12 Thread David Kim
Hi everyone, I'm wondering what people consider the most efficient and brain-damage free way to automate the creation of presentation slides with Python. Scripting Powerpoint via COM? Generating a Keynote XML file? Something else that's easier (hopefully)? I'm imagining a case where one does cert

Re: [Tutor] Automating creation of presentation slides?

2009-08-12 Thread David Kim
rs, DK On Wed, Aug 12, 2009 at 8:52 AM, Kent Johnson wrote: > On Wed, Aug 12, 2009 at 12:51 AM, David Kim wrote: > > Hi everyone, > > > > I'm wondering what people consider the most efficient and brain-damage > free > > way to automate the creation o

Re: [Tutor] Automating creation of presentation slides?

2009-08-12 Thread David Kim
Unfortunately I live on the East Coast, otherwise I'd definitely attend! I am attracted to the declarative nature of reStructuredText, but I also recognize that A LOT of people use Powerpoint and are comfortable with it. Going with something else might freak people out. It also occurs to me that E

Re: [Tutor] python's database

2009-08-16 Thread David Kim
I don't know how much it's in use, but I thought gadfly ( http://gadfly.sourceforge.net/) was the db that's implemented in python. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Help on input error

2009-08-19 Thread David Shunick
I'm trying to learn Python, but keep running into the erroor message ImportError: no module named area. I created a file area.py in IDLE. I'm using Python 3.1 and Window XP. After saving the file in c:/Python31/Lib/Python Modules/area.py I can run the program using F5. But when I start a new s

[Tutor] help cvs module writerow issue

2009-08-20 Thread David Jamieson
r)     #removing the last , from the output_str variable     output_str = output_str[0:(str_length-1)]     print "The final output string is ",output_str     print "The output string is of type ",type(output_str)     #list(output_str)     csv.writer(file_out).writerow([time_stamp, output

Re: [Tutor] help cvs module writerow issue (Now Fixed)

2009-08-21 Thread David Jamieson
quot;,output_str > print "The output string is of type ",type(output_str) > #list(output_str) > csv.writer(file_out).writerow([time_stamp, output_str]+['2']) >Here you are saying that you want to write a row with three elements - &

[Tutor] Processing a string of bytes

2009-09-03 Thread David Perlman
I have successfully used the builtin "wave" module to read an audio file in as a string of bytes: >>> x=wave.open('DaCWL.wav','rb') >>> x.getparams() (1, 2, 44100, 15440, 'NONE', 'not compressed') >>> samp=x.readframes(15440) >>> type(samp) The x.getparams() indicates that there is one audio

Re: [Tutor] How to iterate through unicode string.

2009-09-04 Thread David Stanek
Regards, >>> Allen >>> >>> >>> ___ >>> Tutor maillist - Tutor@python.org >>> To unsubscribe or change subscription options: >>>

Re: [Tutor] Help deciding between python and ruby

2009-09-04 Thread David Kim
On Fri, 2009-09-04 at 06:18 -0700, dan06 wrote: > I'd like to learn a programming language - and I need help deciding between > python and ruby. I'm interesting in learning what are the difference, both > objective and subjective, between the two languages. I know this is a python > mailing list, s

[Tutor] Poorly understood error involving class inheritance

2009-09-10 Thread David Perlman
I'm not sure why I'm getting an error at the end here: >>> class dummy: ... def __init__(self,dur=0): ... self.dur=dur ... >>> z=dummy(3) >>> z.dur 3 >>> z=dummy(dur=3) >>> z.dur 3 That worked fine, of course. >>> class dummy2(str): ... def __init__(self,dur=0): ...

Re: [Tutor] Poorly understood error involving class inheritance

2009-09-10 Thread David Perlman
Well, here's what I am really doing: class oneStim(str): def __init__(self, time, mods=[], dur=None, format='%1.2f'): self.time=time self.mods=mods self.dur=dur self.format=format def __cmp__(self,other): return cmp(self.time,other.time) def _

Re: [Tutor] Poorly understood error involving class inheritance

2009-09-10 Thread David Perlman
Yeah, this seems to be the best answer in this situation. :) On Sep 10, 2009, at 4:17 PM, Kent Johnson wrote: I would skip the cleverness of trying to subclass string. You can use str(z).rjust(20) as above, or use string formatting: '%20s' % z -- -dave---

[Tutor] Parsing html tables and using numpy for subsequent processing

2009-09-15 Thread David Kim
Hello all, I've finally gotten around to my 'learn how to parse html' project. For those of you looking for examples (like me!), hopefully it will show you one potentially thickheaded way to do it. For those of you with powerful python-fu, I would appreciate any feedback regarding the direction I

Re: [Tutor] Parsing html tables and using numpy for subsequent processing

2009-09-17 Thread David Kim
ok at the link you posted as well (I'm traveling at the moment). Cheers, -- David Kim "I hear and I forget. I see and I remember. I do and I understand." -- Confucius morenotestoself.wordpress.com financialpython.wordpress.com ___ Tutor m

[Tutor] Confusion with $PATH

2009-09-25 Thread David Eric
Very new to python..getting accustomed to files, directories etc I installed a few versions of python and ended up with a very long PATH variable, do i need this or can i change it to something shorter? Doing an online tutorial one exercise was to move a simple program, helloworld into the PATH so

Re: [Tutor] Poorly understood error involving class inheritance

2009-10-05 Thread David Perlman
OK, I thought I had this one fixed but it was weirder than I thought. I think I understand what's going on, but I wanted to check with the experts here. I have the following class definition, which does not subclass anything: class oneStim: def __init__(self, time, mods=[], dur=None, fo

[Tutor] Help or Advice on MySQL, Python and test data storage

2009-10-08 Thread David Jamieson
dvance for any responses to my questions. -- Cheers David. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] writing sample program that zips files and saves in a backup directory

2009-10-13 Thread David Eric
doing a python tutorial and one of the assignments says to develop a program that backsup files to zip files into a backup directory im using Darwin 10.0.0 unix version: this is what i came up with thus far, i did copy the sample program given but made changes for my unix OS: #!/usr/bin/env pyth

Re: [Tutor] writing sample program that zips files and saves in a backup directory

2009-10-13 Thread David Eric
On Tue, Oct 13, 2009 at 4:14 PM, Dave Angel wrote: > (You top-posted, instead of adding your part to the end. That's frowned > upon in a mailing list, at least in this one.) > (You replied privately, and forgot to CC the tutor list. I'm forwarding it > there with my resp

Re: [Tutor] writing sample program that zips files and saves in a backup directory

2009-10-13 Thread David Eric
On Tue, Oct 13, 2009 at 4:02 PM, Kent Johnson wrote: > On Tue, Oct 13, 2009 at 2:58 PM, David Eric wrote: > > printing the command line, > > would it be > > print('gzip {0} {1}'.format(target, ' '.join(source))? > > Yes, or just > print zip

Re: [Tutor] writing sample program that zips files and saves in a backup directory

2009-10-13 Thread David Eric
On Tue, Oct 13, 2009 at 5:17 PM, Kent Johnson wrote: > On Tue, Oct 13, 2009 at 4:38 PM, David Eric wrote: > > > as far as print zip_command, i would add that to the program however, > doesnt > > just declaring it actually trigger it..thus it would executed and the >

[Tutor] Methods that return instances of their own class?

2009-10-15 Thread David Perlman
I'm trying to figure out how to define a class so that its instances have a method that return a different object of the same class. In particular, I'm trying to run a simple prisoner's dilemma game, and I want to make a "game" object that has a method which returns the "game" object with t

Re: [Tutor] Methods that return instances of their own class?

2009-10-15 Thread David Perlman
Oh my goodness, it really is that easy! I guess I assumed that was too simple to work. Silly me. Thanks Andre! On Oct 15, 2009, at 10:31 AM, Andre Engels wrote: On Thu, Oct 15, 2009 at 5:14 PM, David Perlman wrote: I'm trying to figure out how to define a class so that its inst

Re: [Tutor] Methods that return instances of their own class?

2009-10-15 Thread David Perlman
Maybe there's a prettier way to do this, but I did it explicitly like this because the "transpose" I needed was specific to the structure of the game payoff matrix; it isn't a normal mathematical transpose. I agree that it's hard to read but I'm not sure the specific needs of this applicat

[Tutor] subclass question

2009-12-19 Thread David Perlman
If I make a subclass of a built-in class, like this: class mylist(list): def __init__(self): list.__init__(self) Then it is valid for me to do this: >>> x=mylist() >>> x.hello=3 >>> But I can't do this: >>> y=list() >>> y.hello=3 Traceback (most recent call last): File "", line

Re: [Tutor] using mechanize to authenticate and pull data out of site

2009-12-26 Thread David Abbott
On Sat, 2009-12-26 at 16:46 +0100, Norman Khine wrote: > Hello, > > I am trying to authenticate on http://commerce.sage.com/Solidarmonde/ > using urllib but have a problem in that there are some hidden fields > that use javascript to create a security token which then is passed to > the submit but

[Tutor] Mainframe experience

2004-12-18 Thread David Holland
Sadly in my IT company (which I better not name), mainframe experience seems to be a route to redundancy ! Fortunately I work with Oracle. === message truncated === ___ ALL-NEW Yahoo! Messenger - all ne

RE: [Tutor] O.T.

2004-12-27 Thread David Broadwell
As the sig says, I'm David Broadwell. I'm 29, 30 this July. Married in hurricane alley (Florida), with a 18 month old daughter. I'm a student as well, finishing my AA.ENGR and heading to USF for a Dual Bachelors of CS and EE. I'm instrumentally challenged as far as making

[Tutor] Using the £ symbol

2004-12-28 Thread David Holland
I am trying to use a program that usea s '£' symbolon the pygame screen and I get this message :- 'sys:1: DeprecationWarning: Non-ASCII character '\xc2' in file birdgame29e.py on line 88, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details line 86 ' Now I did look th

[Tutor] OT

2004-12-31 Thread David Holland
I am 31 married, living in London UK. I can play guitar but I am not that good. I work in IT as Oracle support but the only languages I know apart from basic python is basic PL/SQL and of course SQL. Of course I know how to use various Oracle applications. I studied Chemistry but sadly there were

[Tutor] ASCII encoding for a £ sign

2004-12-31 Thread David Holland
I ran a program with a "£" sign, and I got this message :- "sys:1: DeprecationWarning: Non-ASCII character '\xc2' in file birdgame32a.py on line 93, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details' I looked at the message but I am not sure what encoding to use fo

[Tutor] Fwd: ASCII encoding for a £ sign

2004-12-31 Thread David Holland
Apologies, I did not see that Kent had already answered this ! Thanks Kent I put that encoding and it works fine. Although surprisingly the other idea :- write the string with '\xc2' did not work. --- David Holland <[EMAIL PROTECTED]> wrote: > Date: Fri, 31 Dec 2004 16:28:59

[Tutor] Using £ in python

2005-01-01 Thread David Holland
so it > is more specific > than "Re: Contents of Tutor digest..." > > > Today's Topics: > > 1. Re: O.T. (Michael Lange) >2. OT (David Holland) >3. ASCII encoding for a ? sign (David Holland) >4. Fwd: ASCII encoding for a ? sign (David &g

[Tutor] CGI help

2005-01-03 Thread David Holland
I have written my first cgi script :- The .html code is :- Friends CGI Demo (Static Screen) Friends list for:New User Enter your name> How many friends do you have ? 0 10 25 50 100 The python code is :- #!/usr/bin/env python import cgi reshtml = '''Content-Type: text/html\n Friends CGI Demo (

[Tutor] CGI help

2005-01-04 Thread David Holland
Rich, That worked although I had to set the address to :- http://127.0.0.1:8000/friends1.html Thanks. ___ ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com __

[Tutor] Python on linux

2005-01-05 Thread David Holland
You can use idle while using linux, just type in idle from a command prompt ! ALL-NEW Yahoo! Messenger - all new features - even more fun! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] games written in jython for a web page

2005-01-05 Thread David Holland
Does anyone know about tutorials (or open source projects) about writing in games in pure python (ie without using pygame). The reason is because I wrote a game using pygame but I would like to convert it to a game that can be played in a webpage as a Jython, (like a Java game) of course this is ha

[Tutor] Crossword program

2005-01-09 Thread David Holland
I wrote a program to create crosswords in python. It is not perfect but it works, is there any open source place I can put this for it to be used by anyone who wants it ? (Subject to the gpl licence). Here is the code in case anyone is interested. from Tkinter import * #Crossword program David

Re: [Tutor] Slightly OT - Python/Java

2005-01-09 Thread David Rock
ChiPy, is going to have a speaker on Jython this Thursday, January 13th. For more information, check out the group site at: http://www.chipy.org Everyone is welcome, benginner to advanced. We love all kinds of input. You'd be surprised what you can learn when you get the chance to actually

[Tutor] CGI problem

2005-01-10 Thread David Holland
o) return info print "Content-type: text/html\n" print "Languages" print "This will happen" showboroughinfo(form) #print "Hi" print '' For some reason it is not get the info in the try block. If I do not have the try block I get this m

[Tutor] CGI problem

2005-01-11 Thread David Holland
Thanks for the help it solved the problem. Message: 8 Date: Mon, 10 Jan 2005 16:05:59 -0800 From: "Patric Michael" <[EMAIL PROTECTED]> Subject: Re: [Tutor] CGI problem To: tutor@python.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=US-ASCII Hi

Re: [Tutor] Python with MySQL ?

2005-01-11 Thread David Rock
The best one I've You might want to check out sqlobject, too http://sqlobject.org/ It gives you a relatively simple way to "objectify" SQL statements. -- David Rock [EMAIL PROTECTED] pgpRBRwPdqdc0.pgp Description: PGP signature ___

Re: [Tutor] Crossword program

2005-01-12 Thread David Holland
Thanks Alan for that suggestion.  I will try and tidy it up myself and then ask the tutor list for another suggestions.Alan Gauld <[EMAIL PROTECTED]> wrote: Hi David,Its probably the kind of thing you could put on theUseless Python website. Useless is a collection ofnot-too-serious so

Re: [Tutor] A somewhat easier way to parse XML

2005-01-18 Thread David Rock
know ;-) Still, I can't help wishing I had a simple way to create a dict from a DOM. From a Python perspective, that seems more "Pythonic" to me as well. I guess it's just a different way of looking at it. -- David Rock [EMAIL PROTECTED] pgpq4Ua00eRSO.pgp Description: PGP signa

Re: [Tutor] A somewhat easier way to parse XML

2005-01-19 Thread David Rock
* Max Noel <[EMAIL PROTECTED]> [2005-01-19 11:48]: > > On Jan 19, 2005, at 03:58, David Rock wrote: > > >For me, it seems that the way you are supposed to interact with an XML > >DOM is to already know what you are looking for, and in theory, you > >_should

[Tutor] Print record x in a file

2005-01-22 Thread David Holland
This will get a random record I hope you do not think the comments are patronising but you did say you are new so I did not want to give naked code. import random #the above gives the program the ability to get a #pseudo random number file = open('test.rantxt') listcontents = file.readlines() #gi

Re: [Tutor] Print record x in a file

2005-01-23 Thread David Holland
--- "Jacob S." <[EMAIL PROTECTED]> wrote: > > This will get a random record > > I hope you do not think the comments are > patronising > > but you did say you are new so I did not want to > give > > naked code. > > > > import random > > #the above gives the program the ability to get a > > #pseud

[Tutor] Print record x in a file

2005-01-23 Thread David Holland
1. Re: Print record x in a file (Kent Johnson) >2. How would python messure up in performance? > (Kevin) >3. Re: How would python messure up in > performance? (Max Noel) >4. Re: Print record x in a file (David Holland) >5. on the way to find p

[Tutor] Print record x in a file

2005-01-24 Thread David Holland
Kent,   Yes you are right.  I looked at your code and that makes sense now. Thanks for explaining that.   ALL-NEW Yahoo! Messenger - all new features - even more fun! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/t

Re: [Tutor] newbie OSX module path question

2005-02-14 Thread David Rock
this means. Thanks again. It means it didn't find anything that matches that pattern, which suggests that the directory does not contain *.py files. That might be a problem. ;-) -- David Rock [EMAIL PROTECTED] pgpmTRknYUp8c.pgp Description: PGP signature

Re: [Tutor] reading from stdin

2005-03-01 Thread David Rock
roach to this, I like to use the fileinput module. In the case of the original example of mimicing grep, it allows you to easily handle both a list of files passed to the command or use it as a pipe. The default action if there are no files given is to use stdin. http://www.python.org/doc/2.4/l

[Tutor] Make a .exe

2005-03-04 Thread David Holland
I have a game I wrote using python and pygame that I am trying to change into a .exeI created the script setup.py which has this code :- setup.pyfrom distutils.core import setupimport py2exesetup(console=["Gamename.py"]) In a dos prompt with all the files there I ran :-python setup.py py2exe It Com

<    1   2   3   4   5   6   7   8   9   10   >