Re: [Tutor] Creating folders

2007-01-10 Thread Glenn T Norton
Toon Pieton wrote: > Hey friendly users! > > My question is pretty simple. How can I create a folder with Python? > Trying to make a program which will allow me to save my notes (txt > files) quickly and cleanly. Having to create folder manually would > really make it a bit obsolete. > > Thanks

Re: [Tutor] Writing a list in a text file

2006-12-03 Thread Glenn T Norton
Mihai Iacob wrote: >Hello > > >def saveBugs(data): >store = open(filename, 'w') >for timeMark,aList in data.items(): >store.write(timeMark + '\n') >store.write(aList + '\n') >store.close() > >data is a dictionary >aList is a list > >After i run this part the following e

Re: [Tutor] Database Table Primary Keys

2006-11-21 Thread Glenn T Norton
Tod Haren wrote: >Using a DBAPI 2.0 module such as ADODBAPI, how can a I identify the >primary key fields of a table. cursor.desctription doesn't hold this >info, unless I'm missing something. I just don't see it in the >documentation. Maybe there's an SQL statement I haven't found yet. > >Is t

Re: [Tutor] One million and counting

2006-10-31 Thread Glenn T Norton
Alan Gauld wrote: >Hi folks, > >In just thought I'd mention that my web tutor has now passed >the million visitors mark. Thanks to all those on the tutor >list who have paid a visit. > >Alan Gauld >Author of the Learn to Program web site >http://www.freenetpages.co.uk/hp/alan.gauld >

Re: [Tutor] re-import

2006-10-29 Thread Glenn T Norton
jhl wrote: > Hi- > > How is the 1st import of a module removed so that new edits on the > module can be re-imported? > > DETAIL: > > I am working on a module/file and importing it into a python shell, > trying it out and then tweaking/editing the module. Then to see the > effects of the edits,

Re: [Tutor] basic question ...

2006-10-27 Thread Glenn T Norton
Ravi Kondamuru wrote: > Hi, > > How does one figure all the builtin libraries/ classes that python > supports? > > For example if I want to sort a list of names, I would normally think > of implementing the sorting routine in C. I am just beginning to learn > python. It looks like there is a ri

Re: [Tutor] Getting the type of a variable

2006-10-27 Thread Glenn T Norton
Etrade Griffiths wrote: >Hi > >I want to check the type of a variable so that I know which format to use >for printing eg > >def print_correct_format(a): > > if type(a) == 'int': > print "a is an integer, value %i" % (a) > elif type(a) == 'float': > print "

Re: [Tutor] Equivalent to perl -e

2006-10-15 Thread Glenn T Norton
Chris Lasher wrote: >My professor and advisor has been "inspired" by me to give Python a >try. He's an avid Perl user, and challenged me with the following: > >What is the Python equivalent to perl -e ''? > >Embarassingly, I had no answer, but I figure, someone on the list will >know. His use of P

Re: [Tutor] CGIHTTPServer - redirect output to a log file

2006-10-15 Thread Glenn T Norton
Paulino wrote: >How can I redirect the output of an CGIHTTPServer from the console to a >logfile? >___ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor > > > You can start it from a shell script #!/bin/sh ./MyWebServ

Re: [Tutor] Python Magazine

2006-10-14 Thread Glenn T Norton
Amadeo Bellotti wrote: > I no im probally not the best pereson to go about this but maybe > people in this community are. I was wondering if there was or maybe > someone can start a Python maganize kinda like 3dCreative or 2d > Artist. that is an PDF magazine with tutorials interviews, python

Re: [Tutor] A puzzle for you

2006-10-14 Thread Glenn T Norton
John Fouhy wrote: >>From the python_dev LiveJournal community --- > >Predict the outcome of the following code: > >## >from random import * >seed() >[choice(dict((x+1,0) for x in range(1000))) for x in range(693)][0] >## > > > random.choice( [ SyntaxError: invalid syntax, 42 the answer is young

Re: [Tutor] Help

2006-10-01 Thread Glenn T Norton
Kefka Palazzo wrote: > OK, first of all, I just started learning python a few hours ago so > deal with me here. > > I'm picking up quite fast on Python since I took a C++ class a year > ago when i was 13. However, before I go deep into learning it, I want > to know if Python will work for the p