Hi all,
After a rather long (and unfortunate) break from tinkering with Python, I am
back at it. I am working through the book Learning Python (based on 2.2/2.3
- I use 2.5), and in the chapter on while/for loops, ran across the
following example:
>>> L = [1, 2, 3, 4, 5]
>>> for i in range(len(L
On my Windows XP box running Python 2.4, I attempted to use the 'find'
module per the example in Programming Python (Ch. 2) - i.e.:
>>>import find
>>>find.find('*')
However, Python didn't find the find module. The docs say it's now
deprecated, but don't point to what tool should be used to replac
The book, "Programming Python", shows an example of os.chdir() on the
Windows platform, as follows:
os.chdir(r'c:\temp')
What's the 'r' for? It didn't seem to make any difference in how
Python works - at least not on the surface.
Thanks,
Don
--
DC Parris GNU Evangelist
http://matheteuo.org/
[E
On Tue, 2 Aug 2005 10:12:28 +0100
"Alan G" <[EMAIL PROTECTED]> wrote:
>
> > I forgot to tell that I use Python 2.2.3. When I first got Python, I
> > got
> > 2.4.1, but it refused to run the second time. So I went and got
> > 2.2.3. Your answer would make sense if I had 2.4.1, but I don't.
>
>
On 7/28/05, Gabriel Farrell <[EMAIL PROTECTED]> wrote:
> On Wed, Jul 27, 2005 at 07:13:49PM -0400, Don Parris wrote:
> > pg/pgdb are both part of the PyGreSQL distribution. You can choose
> > whichever you want to use, but pgdb supports the 2.0 API, whereas
> > (accor
On 7/27/05, Gabriel Farrell <[EMAIL PROTECTED]> wrote:
> Are you using PyGreSQL? import pgdb works fine for me with PyGreSQL.
> I'm on Debian but I assume there's a package for it for SUSE.
>
> gsf
>
>
pg/pgdb are both part of the PyGreSQL distribution. You can choose
whichever you want to us
O.k., I'm running SUSE Linux 9.2, Python 2.3.4,
I have changed my DB back-end from MySQL to Postgres for the larger
feature set. However, in attempting to load the pgdb module for use
in my script, I got this message (same when I try it at the
command-line):
>>> pgdb.connect('localhost:chaddb_a
On 7/18/05, Bernard Lebel <[EMAIL PROTECTED]> wrote:
> See [Bernard]
>
>
> [Bernard] Well I kind of figured it was telling it's a syntax error. ;-)
>
I didn't want to assume too much. ;)
> After trial and error for an hour or two, I managed to get it sorted.
>
> First, I noticed that in Pytho
On 7/18/05, Bernard Lebel <[EMAIL PROTECTED]> wrote:
> Hello,
>
> How do I create a MySQL table in Python?
>
> Here is what I'm trying:
>
>
> import MySQLdb as sql
>
> def connect2db():
> return sql.connect( blah blah blah )
>
>
> oConnection = connect2db()
> oCursor = oConnection.curs
On 7/18/05, Bernard Lebel <[EMAIL PROTECTED]> wrote:
> Hello,
>
> How do I create a MySQL table in Python?
>
> Here is what I'm trying:
>
>
> import MySQLdb as sql
>
> def connect2db():
> return sql.connect( blah blah blah )
>
>
> oConnection = connect2db()
> oCursor = oConnection.curs
On Thu, 14 Jul 2005 08:55:35 +0530
Sandip Bhattacharya <[EMAIL PROTECTED]> wrote:
> ZIYAD A. M. AL-BATLY wrote:
> >
>
> You really should look at the wxwindows licence then.
> http://www.opensource.org/licenses/wxwindows.php
>
> It is LGPL + more freedom for commercial users.
>
>
> >
> >
On Tue, 12 Jul 2005 10:49:22 +0100
Dave S <[EMAIL PROTECTED]> wrote:
> This is a bit OT but here goes.
>
> My work wants me to write a fairly large python script to analyze some
> technical ASCII data files. Python and its libraries are GPL.
>
> That being the case am I right in thinking that my
For some reason, everytime I think I finally understand the passing
arguments thing, I prove that I don't. However, I *am* getting a
little closer to getting it.
# Here I just created a couple of variables to print, and then
prt_Name returns g.
def prt_Name():
g = 'foo'
a = 'bar'
prin
On 7/8/05, luke p <[EMAIL PROTECTED]> wrote:
> just assume all the below code is correct.
> I am not having a problem with it, it is all for example only.
>
> I have a dictionary like this:
> alpha = {'a':0,'b':0, ... 'z':0}
> and the following code
> f = file("hamlet.txt","r")
> text = f.readline
On 7/5/05, Don Parris <[EMAIL PROTECTED]> wrote:
> Greetings,
>
> I have a script that gets a little info from the user, using a
> dictionary, which I then store in a file via cPickle. This pickle
> concept must be good for something, but I haven't figured out exactl
Greetings,
I have a script that gets a little info from the user, using a
dictionary, which I then store in a file via cPickle. This pickle
concept must be good for something, but I haven't figured out exactly
what just yet. At any rate, I would like to now get the code and be
able to display on
On Fri, 1 Jul 2005 12:09:03 -0500
"Jacob S." <[EMAIL PROTECTED]> wrote:
>
> - Original Message -
> From: "Don Parris" <[EMAIL PROTECTED]>
> To:
> Sent: Thursday, June 30, 2005 12:23 AM
> Subject: Re: [Tutor] Alternative File I/O for T
On Wed, 29 Jun 2005 14:09:41 -0400
Kent Johnson <[EMAIL PROTECTED]> wrote:
> Don Parris wrote:
> > ### playing with wrapfunc (all other args are the same) ###
> > wrapfunc=lambda x:wrap_onspace(str(rows), x))
> >
> > also
> > wrapfunc=lambda x:str(wrap_
On Wed, 29 Jun 2005 12:37:45 -0400
Kent Johnson <[EMAIL PROTECTED]> wrote:
> Don Parris wrote:
> > On Wed, 29 Jun 2005 06:38:36 -0400
> > Kent Johnson <[EMAIL PROTECTED]> wrote:
> >>Don Parris wrote:
>
> This is a tough one to interpret. The value be
On Wed, 29 Jun 2005 06:38:36 -0400
Kent Johnson <[EMAIL PROTECTED]> wrote:
> Don Parris wrote:
> > On Tue, 28 Jun 2005 05:50:54 -0400
> > Kent Johnson <[EMAIL PROTECTED]> wrote:
Thanks for the explanation of indentation! I kind of understood that, but
wanted to be
On Tue, 28 Jun 2005 05:50:54 -0400
Kent Johnson <[EMAIL PROTECTED]> wrote:
> Don Parris wrote:
> > Just getting back to this - Mondays are always hectic. This recipe is
> > the one I saw and like. It looks cool! In my brief efforts tinkering
> > with it, I am not
On Sun, 26 Jun 2005 16:32:08 -0400
Kent Johnson <[EMAIL PROTECTED]> wrote:
> > From: Don Parris <[EMAIL PROTECTED]>
> > To: Danny Yoo <[EMAIL PROTECTED]>
> > Subject: Re: [Tutor] Alternative File I/O for Tuples
> >
> > I guess I'm asking two
On Sun, 26 Jun 2005 16:32:08 -0400
Kent Johnson <[EMAIL PROTECTED]> wrote:
> > From: Don Parris <[EMAIL PROTECTED]>
> > To: Danny Yoo <[EMAIL PROTECTED]>
> > Subject: Re: [Tutor] Alternative File I/O for Tuples
> >
> > I guess I'm asking two
When I pickle a SQL result into a file (ASCII mode), it lays out the data in
an interesting format. When I send it to the printer, I'd like to see it
arranged more like it is on the console screen - in tabbed columns. None of
the tutorial type stuff I've seen even mentions printing files, or acce
On Wed, 22 Jun 2005 15:06:22 -0400
Python <[EMAIL PROTECTED]> wrote:
> On Wed, 2005-06-22 at 14:20 -0400, Don Parris wrote:
> > On Tue, 21 Jun 2005 19:13:43 -0400
> > Python <[EMAIL PROTECTED]> wrote:
> >
> >
Here's my solution, using the code Lloyd
On Tue, 21 Jun 2005 19:13:43 -0400
Python <[EMAIL PROTECTED]> wrote:
Alright, I've had time to play with this and wanted to be sure I understand
this well. It works, so I understand enough to make it work. However, I
see a difference between your code and mine that makes me think I've missed
so
On Tue, 21 Jun 2005 19:13:43 -0400
Python <[EMAIL PROTECTED]> wrote:
> I like to use the following style of code. Since there will be
> passwords, the connection strings should be somewhat protected. Put
> them in a separate file that can be controlled. Here's my sample code.
> >>
As a newbie developer, the easiest way for me to connect to MySQL is to
just copy & paste the connection commands into each funtion I write.
However, I know that's far from ideal, and consumes more time than its
worth. I would like to create a MySQL connection function that I can just
call up whe
On Mon, 20 Jun 2005 09:11:53 +0100
"Alan G" <[EMAIL PROTECTED]> wrote:
> > "raw_input", but I get "H is not defined" when I run the script.
> > Essentially, I'd like the user to enter a number for most items,
> > but use letters for "Help", "Quit", and "Back to Main".
>
> Are you sure? That ki
On Sat, 18 Jun 2005 13:50:56 -0700
nephish <[EMAIL PROTECTED]> wrote:
> Hey there,
>
> i have used the cgi module and dig it.
> heres the deal,
> my employer wants me to build a dynamic website that will access a
> database and display customer
> information on web. ok, easy enou
On Thu, 16 Jun 2005 12:24:32 -0400
Kent Johnson <[EMAIL PROTECTED]> wrote:
> > Mind you, there may be other areas where I need an OS-specific command.
> > I'm beginning to get an idea of the challenges of portability though. ;)
>
> Python actually gets a lot of this right, you may find it's ea
On Thu, 16 Jun 2005 11:16:37 -0400
Kent Johnson <[EMAIL PROTECTED]> wrote:
> Don Parris wrote:
> > With the console-based menu system I'm building, I'd like to clear the
> > screen for each menu call - something like:
> >
> > def main_menu():
>
With the console-based menu system I'm building, I'd like to clear the
screen for each menu call - something like:
def main_menu():
clear #start with a fresh console screen, menu at top
print menuitems
This way, the users won't have to get too confused by all the previous
screens.
I hav
On Wed, 15 Jun 2005 07:46:40 -0600
Mike Hansen <[EMAIL PROTECTED]> wrote:
> > Subject:
> > Re: [Tutor] Controlling Where My Program Ends
> > From:
> > Don Parris <[EMAIL PROTECTED]>
> > Date:
> > Tue, 14 Jun 2005 23:03:59 -0400
> > To:
On Wed, 15 Jun 2005 00:59:24 -
"DC Parris" <[EMAIL PROTECTED]> wrote:
> Never mind. I found it - sys.exit()
>
> Sorry to have wasted the bandwidth/time.
> --
This was in reference to a post about exiting from a program. I couldn't
figure out why my program wouldn't let me exit from within
Oops! Didn't mean to reply off-list.
On Sat, 11 Jun 2005 23:16:47 +0100
"Alan G" <[EMAIL PROTECTED]> wrote:
> HI Don,
>
> > > > result = Cursor.fetchone()
> > > > Con.close()
> > > >
> > > > # Count the fields
> > > > result.num_fields()
>
> > Should I have done something more like this?
> >
Greetings,
I've dabbled in programming/scripting a little, but never really seem to get
the hang of it. I thought I'd try out Python for a front-end to my
SQL database project. I've worked through the tutorial, and a few others to
some extent. At the moment, I'm really just tinkering, but have
37 matches
Mail list logo