Re: [Tutor] reafline reads file, not just 1 line

2007-03-30 Thread Kirk Bailey
Setting a registry key does sound like a nice idea, but I must research it. Until I understand how so,mething works, I do now want to use it, which is why the RE. definition for determining wikiwords is commented out- someone suggested it, but it leaves me in the fog, I must study re more first

[Tutor] os.path.isfile and isdir

2007-03-30 Thread Greg Perry
It looks like both os.path.isfile and os.path.isdir evaluate to False for a wildcard, so that makes it a bit easier to deal with a mask. Thanks to everyone for the suggestions. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/lis

Re: [Tutor] getopts question

2007-03-30 Thread Andreas Kostyrka
* Greg Perry <[EMAIL PROTECTED]> [070331 01:21]: > Yeah I figured that. I am trying to find a way to have the program detect if > the user input is a file or directory, which is easy enough with os.path. > However, os.path makes no distinction between a regular file and a mask, eg > filename.t

Re: [Tutor] getopts question

2007-03-30 Thread Greg Perry
Yeah I figured that. I am trying to find a way to have the program detect if the user input is a file or directory, which is easy enough with os.path. However, os.path makes no distinction between a regular file and a mask, eg filename.txt or *.txt. I guess I'll have to have a second set of t

[Tutor] hashlib weirdness

2007-03-30 Thread Greg Perry
Here's one that has me stumped. I am writing a forensic analysis tool that takes either a file or a directory as input, then calculates a hash digest based on the contents of each file. I have created an instance of the hashlib class: m = hashlib.md5() I then load in a file in binary mode: f

[Tutor] Fw: 2) 'WHICH MULTI'

2007-03-30 Thread ALAN GAULD
One of my tutorial users has come upon a really weird bug. He has sent a transcript oif his session. Notice that wx is not defined yet doing help(wx) produces a strange message. The message ius actually something he wrote as part of a wxPython application exercise, but this is showing up on a f

Re: [Tutor] A string-manipulation question

2007-03-30 Thread Bob Gailer
[EMAIL PROTECTED] wrote: > Alan Gilfoy wrote: > > > Is there a way in Python to separate a string into its component words. > you could do something like this: > >>> x = Is there a way in Python to seperate a string into its > compontent words. > >>> x.split() > that would yield: > ['Is', 'there',

Re: [Tutor] [OT] ETL Tools

2007-03-30 Thread Bob Gailer
Stephen Nelson-Smith wrote: > Hello all, > > Does anyone know of any ETL (Extraction, Transformation, Loading) > tools in Python (or at any rate, !Java)? > I have under development a Python tool that is based on IBM's CMS Pipelines. I think it would be suitable for ETL. It would help me to see

Re: [Tutor] range()-like function for dealing with floats...?

2007-03-30 Thread Carroll, Barry
> -Original Message- > Date: Fri, 30 Mar 2007 19:28:51 +0200 > From: Andreas Kostyrka <[EMAIL PROTECTED]> > Subject: Re: [Tutor] range()-like function for dealing with floats...? > To: "Carroll, Barry" <[EMAIL PROTECTED]> > Cc: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Ty

Re: [Tutor] reafline reads file, not just 1 line

2007-03-30 Thread Luke Paireepinart
Kirk Bailey wrote: > >> This looks fine to me. How do you know it's reading them all into >> the first item? > I inserted some t4emporary code to print the variable name, then > value. The > first one spewed the entire page, the others were null strings. Okay, just makin' sure. >> >>> # Begin na

Re: [Tutor] range()-like function for dealing with floats...?

2007-03-30 Thread Andreas Kostyrka
* Carroll, Barry <[EMAIL PROTECTED]> [070330 19:15]: > Try entering "python range float" at your personal favorite search > engine. I tried it on Google. Here is the first entry returned: > > ASPN : Python Cookbook : frange(), a range function with float > ... > Sadly missing in the

Re: [Tutor] how to run a text file in an interpreter?

2007-03-30 Thread Andreas Kostyrka
* Tonu Mikk <[EMAIL PROTECTED]> [070330 18:52]: > I started reading Instant Python tutorial ( > http://hetland.org/writing/instant-python.html ) and came across this > section: > "/Note:/ To get the examples working properly, write the programs in a > text file and then run that with the interpr

Re: [Tutor] range()-like function for dealing with floats...?

2007-03-30 Thread Carroll, Barry
> -Original Message- > Date: Fri, 30 Mar 2007 14:47:26 +0530 > From: "Joydeep Mitra" <[EMAIL PROTECTED]> > Subject: [Tutor] range()-like function for dealing with floats...? > To: tutor@python.org > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="iso-8859-1" >

[Tutor] how to run a text file in an interpreter?

2007-03-30 Thread Tonu Mikk
I started reading Instant Python tutorial ( http://hetland.org/writing/instant-python.html ) and came across this section: "/Note:/ To get the examples working properly, write the programs in a text file and then run that with the interpreter; do /not/ try to run them directly in the interactiv

[Tutor] how to run a text file in an interpreter?

2007-03-30 Thread Tonu Mikk
Hello, I am new to the list and to programming in general. I want to learn Python as I find it an interesting language. I also support an application that is written in Python called Roundup http://roundup.sf.net . I find that I would like to make small tweaks to the program that require a

Re: [Tutor] reafline reads file, not just 1 line

2007-03-30 Thread Luke Paireepinart
Kirk Bailey wrote: > #!C:\Python25\pythonw.exe #! is only for Unix, it's pointless here. > # > import os, os.path, random, sys, string, time, cgitb; cgitb.enable() > # > print "Content-Type: text/html\n" > # > try: > pagename=os.environ['QUERY_STRING']# try to retreive the page > name req

Re: [Tutor] A string-manipulation question

2007-03-30 Thread HouseScript
Alan Gilfoy wrote: > Is there a way in Python to separate a string into its component words. you could do something like this: >>> x = Is there a way in Python to seperate a string into its compontent words. >>> x.split() that would yield: ['Is', 'there', 'a', 'way', 'in', 'Python', 'to', 'se

Re: [Tutor] reafline reads file, not just 1 line

2007-03-30 Thread Kirk Bailey
BINGO! Perfect function! GOD? windows. BUT THANK YOU! (walks off mumbling curses at the billster of gates...) Kent Johnson wrote: > Kirk Bailey wrote: >> a relevant code snip: >> >> if os.path.exists('ConfigureMe'): >> f1=open('ConfigureMe','r') >> tablebgcolor=string.strip(f1.readline

Re: [Tutor] reafline reads file, not just 1 line

2007-03-30 Thread Kirk Bailey
#!C:\Python25\pythonw.exe # import os, os.path, random, sys, string, time, cgitb; cgitb.enable() # print "Content-Type: text/html\n" # try: pagename=os.environ['QUERY_STRING'] # try to retreive the page name requested except exception, e: pagename="FrontPage" # if len(pagename

Re: [Tutor] getopts question

2007-03-30 Thread Andreas Kostyrka
* Kent Johnson <[EMAIL PROTECTED]> [070330 13:04]: > Greg Perry wrote: > > Hello List Members, > > > > I am working on a simple program and would like to know the best way > to approach this. Using getops I am parsing the argv array to grab > command line options; from the command line the user ca

Re: [Tutor] range()-like function for dealing with floats...?

2007-03-30 Thread Eike Welk
On Friday 30 March 2007 11:17, Joydeep Mitra wrote: > Hi all, > I need to generate a sequence of real numbers that are evenly > spaced. I have used loops for this purpose until now, but it gets > kinna messy when you gotta do it a number of times in a program. > The range function, as per my knowle

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

2007-03-30 Thread Kent Johnson
Utkarsh Tandon wrote: > > Is it possible to make daemons for *nix in Python ? How ? Googling "Python daemon" yields many references of which the best seem to be http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012 Kent _

Re: [Tutor] getopts question

2007-03-30 Thread Kent Johnson
Greg Perry wrote: > Hello List Members, > > I am working on a simple program and would like to know the best way to approach this. Using getops I am parsing the argv array to grab command line options; from the command line the user can specify either a filename or a directory (but not both). Is t

Re: [Tutor] A string-manipulation question

2007-03-30 Thread Kent Johnson
Alan Gilfoy wrote: > Awesome! (I was hoping it would be a 1-line solution. :) > Thanks to batteries beign included, I don't necessarily need to worry > about why and how .spilt() works. :) You might want to look at the docs for split() so you can use it again next time you have a need. http://d

Re: [Tutor] range()-like function for dealing with floats...?

2007-03-30 Thread Kent Johnson
Joydeep Mitra wrote: > Hi all, > I need to generate a sequence of real numbers that are evenly spaced. I > have used loops for this purpose until now, but it gets kinna messy when > you gotta do it a number of times in a program. > The range function, as per my knowledge, accepts parameters and r

Re: [Tutor] reafline reads file, not just 1 line

2007-03-30 Thread Kent Johnson
Kirk Bailey wrote: > a relevant code snip: > > if os.path.exists('ConfigureMe'): > f1=open('ConfigureMe','r') > tablebgcolor=string.strip(f1.readline()) > > Eacj line in the file contains color configuration information to > include into a webpage later on (for instance, 'peach, 'wjh

Re: [Tutor] Sloooooow SQL

2007-03-30 Thread Tim Golden
Øyvind wrote: > I have been writing some scripts that gets data from a MSSQL-database. > However, it is very slow. If I use the script, the retrieving of data and > displaying in html takes close to 30 seconds. If I use the SQL Server > Management Query, the same query takes a second or two. Why th

[Tutor] Sloooooow SQL

2007-03-30 Thread Øyvind
Hello. I have been writing some scripts that gets data from a MSSQL-database. However, it is very slow. If I use the script, the retrieving of data and displaying in html takes close to 30 seconds. If I use the SQL Server Management Query, the same query takes a second or two. Why this enormous di

[Tutor] range()-like function for dealing with floats...?

2007-03-30 Thread Joydeep Mitra
Hi all, I need to generate a sequence of real numbers that are evenly spaced. I have used loops for this purpose until now, but it gets kinna messy when you gotta do it a number of times in a program. The range function, as per my knowledge, accepts parameters and return values only as integers. I