[Tutor] Looking for a few commands

2006-09-06 Thread Chris Hengge
Woohoo for my first post!   Simple command to clear console? (C++ was something like system.clr()) Some sort of cursor positioning? (C++ was something like gotoxy)   Thanks alot! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/list

[Tutor] Simple SQL server access...

2006-09-06 Thread Chris Hengge
I've been doing some searching for ways to access existing SQL server databases, but I'm finding so many different ways to do it, is there one that anyone recommends for a "new to python" programmer? I've used VB and C# for accessing SQL, so maybe something that would feel similiar to that to get m

Re: [Tutor] Looking for a few commands

2006-09-06 Thread Chris Hengge
On Wed, 2006-09-06 at 16:30 -0700, Bob Gailer wrote: > Chris Hengge wrote: > > Woohoo for my first post! > > > > Simple command to clear console? (C++ was something like system.clr()) > > Some sort of cursor positioning? (C++ was something like gotoxy) > This is ope

Re: [Tutor] Looking for a few commands

2006-09-07 Thread Chris Hengge
t; > Sorry, neither are intuitively obvious... but he has lots of goodies > on his site, worth perusing the list. And Fred's code is usually > of a very high standard - ie it just works! > > Alan Gauld > Author of the Learn to Program web site > http://www.freenetpages.co.

Re: [Tutor] Looking for a few commands

2006-09-10 Thread Chris Hengge
Nice Find! On Sun, 2006-09-10 at 08:50 +0100, Alan Gauld wrote: > "Chris Hengge" <[EMAIL PROTECTED]> wrote > > Simple command to clear console? (C++ was something like > > system.clr()) > > Some sort of cursor positioning? (C++ was something like gotoxy) &g

[Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
This is what I have, but it requires me to know the end of the column I'm working with, which changes.   try:#Loop through the rows from 6 -> 25    for row in range(6, 25):    #Write each row, increment 1+row in column 5    print >> file, "(%d) => %s" % (row, xlSht.Cells (1+row, 5).Value)

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
from win32com.client import Dispatch soo... that would be com.. sorry about that.. xlSht is the worksheet I'm currently reading from.   On 9/11/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> This is what I have, but it requires me to know the end of the column>

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
Just tried that (pretty sure I already did, but hey... I could have goofed it)   No go  On 9/11/06, Alan Gauld <[EMAIL PROTECTED]> wrote: I'm no expert in Excel programming but I assum,e you triedthe obvious:> I'm looking for something more like > try:#Loop until rows are null>while row in xlwk

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
Hmm... ok... after some thought... this is what I'm looking for   #some great line that gives me an int for the number of not null cells intLastUsedRow = xlSht.Cells.LastValue #Made this up, but basically what I need.   I need to iterate through a range() because I dont know another good way to tel

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
I don't suppose that anyone has a fix for me eh? I've tried about all I can think of and I'd like to be able to give this program a trial tomorrow when I get back to work.. sure would save me some time :] On Mon, 2006-09-11 at 17:48 -0700, Chris Hengge wrote: > Hmm... ok...

Re: [Tutor] Traversing Excel Columns

2006-09-12 Thread Chris Hengge
till working through a couple books on python, so I haven't got all the tricks yet :] Thanks On Tue, 2006-09-12 at 18:03 +1200, John Fouhy wrote: > On 12/09/06, Chris Hengge <[EMAIL PROTECTED]> wrote: > > I don't suppose that anyone has a fix for me eh? I've tried

Re: [Tutor] Traversing Excel Columns

2006-09-12 Thread Chris Hengge
into a text file with single quotes and a comma (sorta like comma seperated values) that need to be on long line(like I've got it above in my working code).   Also, why doesn't 'xlSht.Cells(row + 1, 1).Value' work for this loop, but it did for the previous loop I posted to tutor

Re: [Tutor] Traversing Excel Columns

2006-09-13 Thread Chris Hengge
I'll give that a shot tomorrow when I work on the script some more. Thanks for the note on 'file'... none of the IDE's I've used have colored or yelled at me, so I just assumed it was free for the taking.. (used to VS where it yells at you for more then I'd care) I've just started using SPE thou

[Tutor] Methods and classes

2006-09-13 Thread Chris Hengge
Can anyone explain what I've been reading? I'm trying to understand why many documents show: def myMethod(vars): or class myClass(var): and others show: def myMetheod(self, vars) or class myClass(self, vars) Either way seems to work fine, so I'm not sure what it ha

Re: [Tutor] Methods and classes

2006-09-13 Thread Chris Hengge
ow I've got methods all over the place among several scripts that don't use self, and each other works fine as I'd expect. Thanks for the other information! On Thu, 2006-09-14 at 09:18 +1200, John Fouhy wrote: > On 14/09/06, Chris Hengge <[EMAIL PROTECTED]> wrote: > >

Re: [Tutor] Methods and classes

2006-09-13 Thread Chris Hengge
On Wed, 2006-09-13 at 18:26 -0400, Kent Johnson wrote: > Chris Hengge wrote: > > The deitel book has a note on page 229: > > Failure to specify an object reference (usually called self) as the > > first parameter in a method definition causes fatal logic errors when >

[Tutor] Input mask for console?

2006-09-13 Thread Chris Hengge
I need either a way to mask the input from a console, or a method to not display the typed characters to the screen. Someone point me in the right direction? Thanks. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Input mask for console?

2006-09-13 Thread Chris Hengge
nevermind.. figured it out.. Thanks. On Wed, 2006-09-13 at 19:48 -0400, Kent Johnson wrote: > Chris Hengge wrote: > > I need either a way to mask the input from a console, or a method to not > > display the typed characters to the screen. Someone point me in the >

Re: [Tutor] Input mask for console?

2006-09-13 Thread Chris Hengge
I'm assuming I can use that like usrpass = getpass.getpass(raw_input("Password: ")) On Wed, 2006-09-13 at 19:48 -0400, Kent Johnson wrote: > Chris Hengge wrote: > > I need either a way to mask the input from a console, or a method to not > > display the typed cha

Re: [Tutor] Input mask for console?

2006-09-14 Thread Chris Hengge
!Tiago.>> On Wed, 2006-09-13 at 19:48 -0400, Kent Johnson wrote:> > Chris Hengge wrote:> > > I need either a way to mask the input from a console, or a method to > > > not display the typed characters to the scr

[Tutor] pymssql or ODBC

2006-09-14 Thread Chris Hengge
Does anyone know how to make pymssql use windows authentication?   Also, can anyone point me to a simple ODBC guide for SQL?   I'd like to use ODBC if I can so that users of my software dont have to install extra libraries to use my utilities.   Thanks. __

Re: [Tutor] pymssql or ODBC

2006-09-14 Thread Chris Hengge
4.5 hours... all I'm seeing are a few other libraries, none of which mention having windows authentication :/ On Thu, 2006-09-14 at 16:12 -0700, Chris Hengge wrote: > Does anyone know how to make pymssql use windows authentication? > > Also, can anyone point me to a simple ODBC

Re: [Tutor] pymssql or ODBC

2006-09-14 Thread Chris Hengge
I'm not sure how it works... all the modules I've seen just seem to be wrappers for odbc... but I can't find any information on connection strings.. I guess I could just try the same connection string I use for c#. On Thu, 2006-09-14 at 22:53 -0500, Luke Paireepinart wrote: >

Re: [Tutor] pymssql or ODBC

2006-09-14 Thread Chris Hengge
Now that I've looked, its just a wrapper for _mssql, but this still isn't a solution. On Thu, 2006-09-14 at 22:53 -0500, Luke Paireepinart wrote: > Chris Hengge wrote: > > 4.5 hours... all I'm seeing are a few other libraries, none of which > > mention having window

Re: [Tutor] pymssql or ODBC

2006-09-14 Thread Chris Hengge
OK, so ODBC wont work.. thats not what I thought it was apparently... So... the question remains... how do I use Windows built in authorization in my connection string for an MS SQL2000 server? On Thu, 2006-09-14 at 22:53 -0500, Luke Paireepinart wrote: > Chris Hengge wrote: > >

Re: [Tutor] pymssql or ODBC

2006-09-15 Thread Chris Hengge
tation on this. > > I tend to use http://www.carlprothman.net/Default.aspx?tabid=90 for > connection strings. > > Once we have the cursor object it is just the python db api. > > Hope that helps. > > Joe > > > > Chris Hengge wrote: > > Does anyone

Re: [Tutor] pymssql or ODBC

2006-09-15 Thread Chris Hengge
The originally posted code I was refering to also said *SQL* for the driver... which I'm not sure about.. On Fri, 2006-09-15 at 02:24 -0500, Luke Paireepinart wrote: > Chris Hengge wrote: > > looking at your link, is your con wrong? for example... > > the one on the link you

[Tutor] Keycodes

2006-10-03 Thread Chris Hengge
Is it possible to capture keycodes for things like ctrl/alt/shift?   I've made a script using msvcrt but it seems to skips most of the non alphanumeric keys.   Thanks. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Way to search this mailing list?

2006-10-10 Thread Chris Hengge
Just a simple question... Am I missing some great feature? or is there no way to search rather then going through the archives by hand? Thanks. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Way to search this mailing list?

2006-10-11 Thread Chris Hengge
Thanks to you both for the answer... Even if the data isn't the current emails traveling back and forth, its a step in the right direction... Beats asking the same questions over again when someone asked months prior.. On 10/11/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Chris Hengge w

[Tutor] Creating folders in windows...

2006-10-11 Thread Chris Hengge
I found this from a 2004 mailing on this list..os.path.mkdir('folder') Doesn't work... there is no mkdir in os.path (old style maybe?)>>> os.path.mkdir('folder')Traceback (most recent call last): File "", line 1, in ?AttributeError: 'module' object has no attribute 'mkdir'>>> dir(os.path)['__all_

Re: [Tutor] Creating folders in windows...

2006-10-11 Thread Chris Hengge
chdir('test')no such file or directoryThanks again...On 10/11/06, Chris Hengge <[EMAIL PROTECTED]> wrote:I found this from a 2004 mailing on this list.. os.path.mkdir('folder') Doesn't work... there is no mkdir in os.path (old style maybe?)>>> os.path.mkdir(

[Tutor] Zipfile and File manipulation questions.

2006-10-13 Thread Chris Hengge
First question..This is the code that I have:for filename in zfile.namelist():    outfile = open(filename, 'w')    outfile.write(zfile.read(filename))    outfile.close()Is there a way to say : for filename in zfile.namelist() contains '.txt, .exe':    outfile = open(filename, 'w')  

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-14 Thread Chris Hengge
Excellent suggestion! Thanks!I have a question... is endswith() case sensitive?On 10/14/06, Bill Burns < [EMAIL PROTECTED]> wrote:Chris Hengge wrote:> First question.. >> This is the code that I have:> for filename in zfile.namelist():> outfile = open(filename, 'w')> outfile.write(z

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-14 Thread Chris Hengge
Oops I get an error using that code..     if filename.endswith('.cap','.fru','.hex') or filename.endswith('.sdr', '.cfg'):TypeError: slice indices must be integers or None On 10/14/06, Bill Burns <[EMAIL PROTECTED]> wrote: Chris Hengge

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-14 Thread Chris Hengge
Got that working now, thanks. I've been using activepythons release, and they dont have 2.5 prepared yet. Guess I should just upgrade without them?On 10/14/06, Kent Johnson <[EMAIL PROTECTED]> wrote:Chris Hengge wrote: > Oops I get an error using that code..>> if filename.endswith('.cap','

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-14 Thread Chris Hengge
   else:        outfile = open(afile, 'w') # Open output buffer for writing.     outfile.write(zfile.read(afile)) # Write the file.    outfile.close() # Close the output file buffer.On 10/14/06, Chris Hengge <[EMAIL PROTECTED]> wr

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-14 Thread Chris Hengge
the file, I can't split here)     outfile.write(zfile.read(afile)) # Write the file. (zfile.read(afile)) wont work if I split here...)    outfile.close() # Close the output file buffer. On 10/14/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> Ok, la

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-14 Thread Chris Hengge
Correction... The first comment I just realised I needed "\\" to make it work.. so that issue is gone.. On 10/14/06, Chris Hengge < [EMAIL PROTECTED]> wrote:I was using afile.split("/"), but I'm not sure how to impliment it... if "/" in afile: (for som

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-14 Thread Chris Hengge
ellent learning experience. :D On 10/14/06, Chris Hengge <[EMAIL PROTECTED]> wrote: I was using afile.split("/"), but I'm not sure how to impliment it... if "/" in afile: (for some reason I can't add 'or "\" in afile' on this line)    ou

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-15 Thread Chris Hengge
5/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: On 10/14/06, Chris Hengge < [EMAIL PROTECTED]> wrote: Guess nobody has had a chance to point me in the write direction on this problem yet?Thats ok, I've gotten a ton of other code written, and I'll come back to this tricky part later.T

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-15 Thread Chris Hengge
After getting some sleep and looking at my code, I think I was just to tired to work through that problem =PHere is my fully working and tested code..Thanks to you all for your assistance!if "/" in afile:     aZipFile = afile.rsplit('/', 1)[-1] # Split file based on criteria.     outfile = open(aZi

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-15 Thread Chris Hengge
The code in my last email that I stated worked, is doing exactly what I want (perhaps there is a better method, but this is working)The slash detection is for the subdirectories located inside of a zip file. The name list for a file located inside a zipped folder shows up as folder/file.ext in wind

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-16 Thread Chris Hengge
changes based on your suggestions, I'll re-share the updated code incase anyone out there wants to see. On 10/16/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> I like this little snip of code from your suggestion, and I may> incorporate it...>>

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-16 Thread Chris Hengge
Using one of the things you suggested...> if "/" in afile:> aZipFile = afile.rsplit('/', 1)[-1] # Split file> based on criteria.> outfile = open(aZipFile, 'w') # Open output buffer > for writing.> outfile.write(zfile.read(a

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-16 Thread Chris Hengge
se it. I'm sure this is considered poor method, but once I declare a method I tend to never need to change the declaration, just how I use the info... I hope that makes sense. On 10/16/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> Here is my solution, completed with (

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-16 Thread Chris Hengge
/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> I chose the way I used the names because to me...>> outFile = open(aFile.lower(), 'w') # Open output buffer for writing.> = open a file with lowercase name for writing. > it is implied that aFile is f

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-16 Thread Chris Hengge
[quote]and I didn't read your code[/quote]How's that supposed to help? =D ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-16 Thread Chris Hengge
Have you even read my code to see if you find it cryptic? I'm starting to beleive people just read the one comment on possibly using better naming conventions and assumed I had picked completely irrelivent names. On 10/16/06, Jonathon Sisson <[EMAIL PROTECTED]> wrote: Chris Hengge wrot

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-16 Thread Chris Hengge
the one comment on possibly using better > naming conventions and assumed I had picked completely irrelivent names.>> On 10/16/06, *Jonathon Sisson* <[EMAIL PROTECTED]> [EMAIL PROTECTED]>> wrote:>> Chris Hengge wrote:>  > I chose the way I used the names because

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-17 Thread Chris Hengge
quot; if you wanted to describe someone. Rambling aside... I was just trying to take a light hearted spin because the poor mechanic we have subjected for abuse in this debate struck me funny. On 10/17/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Kent Johnson wrote:> Chris Hengge wrot

Re: [Tutor] Zipfile and File manipulation questions.

2006-10-17 Thread Chris Hengge
eneric variable names as references, and kind of started ignoring variable names.. Seriously... its just how you look at things... I obviously read code and get my understanding very differently then many people on here. I take more of a top down approach, while it sounds many of you take a bottom up a

[Tutor] Searching list items.

2006-10-17 Thread Chris Hengge
contents = readlines(myfile, 'r')Ok, I'm under the impression this is a list of strings (array)How in the world do I cycle through them looking for words?for line in contents: if line.contains("something") print lineThats a mock up of what I'm looking for. I tried to figure out how to

Re: [Tutor] Searching list items.

2006-10-17 Thread Chris Hengge
I remove those lines, but I was trying to usefor line in contents:    result = re.search("something", line)    print resultthis printed out something like NoneNoneNonehex memory address of goodness NoneNone...On 10/17/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Chris Hengge

Re: [Tutor] Searching list items.

2006-10-17 Thread Chris Hengge
An article at devshed was using it like that... but the output wasn't what I was looking for.. I was getting the hex address where the result was, but not printing the line.. I think the simple code you recommended in your first reply will do the trick, I'm not looking for anything magical, just ne

Re: [Tutor] Searching list items.

2006-10-17 Thread Chris Hengge
Not sure if you were challenging me to think, or asking me, but I was wanting to "line" to be printed... as in the string from the list. What I got with re was what I'm assuming was a memory address. On 10/17/06, Danny Yoo <[EMAIL PROTECTED]> wrote: > I remove those lines, but I was trying to use>

[Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
I'm looking for a way to do the following. for item in limitedLineList:    if item in directoryList:    print match.ljust(20) + limitedLineList[count].ljust(20) + directoryList[ count].ljust(20)    else:    print fail.ljust(20) + limitedLineList[count].ljust(20) + directoryL

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
Still no progress with this myself. For clarification if I didn't provide enough earlier, for item in list1:    if item in list2: print item and list[object at location where matched item] <-- need this location. On 10/18/06, Chris Hengge <[EMAIL PROTECTED]> wrote: I'm l

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
What that should have saidFor clarification if I didn't provide enough earlier, for item in list1:    if item in list2: print item and list2[object that matched item] <-- need this location. On 10/18/06, Chris Hengge <[EMAIL PROTECTED]> wrote: Still no progress with th

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
ell it to print the right sentence (using this example) because python does the search internally and doesn't seem to have a way to return the list location where the match occurred. On 10/18/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> Still no progress with this

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
olumn because: if item in list:does not return the list location, so I can't write it out to the screen. On 10/18/06, Chris Hengge < [EMAIL PROTECTED]> wrote:Tried your first suggestion.AttributeError: 'list' object has no attribute 'find' Perhaps a better explanat

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
Why even try to use the 'in' syntax if it's not working correctly?Maybe I still don't understand. -LukeBecause I've been up for 40 hours... 5 days of the week I'm up at 8:45AM and I dont get home until 10PM, once I'm home, I do homework trying to finish my senior year, on the weekends I am either t

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
here is a match, and if there isnt'...It also works for renaming the actual file to match the file call from the document. I'm about to take the display out, since I dont honestly care that it works, but now that I've been working with it I'm being stubborn and want the darn thin

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
it will infact rename the lowercase extension to uppercase, as it should. On 10/18/06, Chris Hengge <[EMAIL PROTECTED]> wrote: I'm looking for a way to do the following. for item in limitedLineList:    if item in directoryList:    print match.ljust(20) + limitedLineList[count]

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
the actual file to match the file call from> the document.>> I'm about to take the display out, since I dont honestly care that it> works, but now that I've been working with it I'm being stubborn and > want the darn thing to show me =P>> On 10/18/06, *Kent Johnson

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
be using it to rename files.. my old structure did EXACTLY what I wanted (I replied to my original post with more details and screen captures) as far as renaming the files.. but the display was screwed up. On 10/18/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> Ok

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
, but the 3rd columns output wasn't correct. Loop = worksDisplay = wrongOn 10/18/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> Yes, I tried what you suggested, I've changed my looping structure to > this:>> count = 0> for itemLine in lin

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
ryList). but, since I dont have a location to write directoryList[here] I can't print it out. I've tried using directoryList[directoryList.index(item)], but that seems to be a case-sensitive check and fails to work. On 10/18/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Chris Hen

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
I think this is overkill for what I'm trying to do, could you please refer to what I just wrote luke? That might make things simpler.. On 10/18/06, John Fouhy <[EMAIL PROTECTED]> wrote:Ok, so your question is: If nothing in directoryList matches item, how do I find theelement of directoryList

Re: [Tutor] Location of found item in list.

2006-10-18 Thread Chris Hengge
play the proper filename in the 3rd output column. I guess os.rename(notcasesensitive, iscasesensitive) ? On 10/18/06, Chris Hengge <[EMAIL PROTECTED]> wrote: I'm looking for a way to do the following. for item in limitedLineList:    if item in directoryList:    print mat

[Tutor] Generic Application Frameworks?

2006-10-19 Thread Chris Hengge
I was curious if there are any frameworks around like carbon/razor implimented in razor? Here's a link with information about razor (.net 1.1 versin of carbon) http://www.codeproject.com/cs/design/razorpt1.aspIf not, is there any reason why? (limitation of python?) _

Re: [Tutor] Location of found item in list.

2006-10-19 Thread Chris Hengge
This is the solution I came up with.     for dirItem in directoryList:    directoryListLower.append(dirItem.lower())    #---Loop for file name comparison.    for item in lineList: # For every item in the 'lineList'     if item in directoryList: # If the item is also in 'directoryList'  

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
I'd personally do something like this. file = open(myfile, 'r')fileContents = file.readlines() # read the entire document into memory for speed.file.close()print fileContents[-1] # This is the last line. On 10/19/06, Asrarahmed Kadri <[EMAIL PROTECTED]> wrote: My algorithm is like this: first count

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
Not to hijack the thread, but what stops you from just putting a file.close() after your example line?On 10/19/06, Chad Crabtree < [EMAIL PROTECTED]> wrote:file('filename.txt').readlines()[-1] Some will say that this is no good because the file is still open.  However I've been told that when the o

Re: [Tutor] Generic Application Frameworks?

2006-10-19 Thread Chris Hengge
Just incase anyone doesn't want to see that document to know what I'm asking about...Razor/Carbon includes:Auto UpdatePlugin System with managementError reportingIts got a few other features, but these are my focus. On 10/19/06, Chris Hengge <[EMAIL PROTECTED]> wrote: I was curi

Re: [Tutor] Generic Application Frameworks?

2006-10-19 Thread Chris Hengge
D] [mailto:[EMAIL PROTECTED]]On Behalf Of Chris HenggeSent: Thursday, October 19, 2006 1:22 PMTo: PyTutorSubject: Re: [Tutor] Generic Application Frameworks? Just incase anyone doesn't want to see that document to knowwhat I'm asking about...Razor/

Re: [Tutor] Generic Application Frameworks?

2006-10-19 Thread Chris Hengge
http://dabodev.com/aboutHere we go... 3 tier application framework.. Thats almost perfect.. I suppose I could figure out the auto update thing myself... since that is all that it is missing for what I was wanting.. Thanks again! On 10/19/06, Chris Hengge <[EMAIL PROTECTED]> wrote: I ran a

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
Oh wow.. I totally missed that... nevermind.. ignore that question =DOn 10/19/06, Danny Yoo <[EMAIL PROTECTED] > wrote:>> file('filename.txt').readlines()[-1]> Not to hijack the thread, but what stops you from just putting a > file.close() after your example line?Which file should file.close() clos

Re: [Tutor] Generic Application Frameworks?

2006-10-19 Thread Chris Hengge
About frameworks being complicated... I'm sure there are exceptions to this, but my experience is that if you think of a framework as a tool, sure , you gotta learn how to use it first, which means it will slow you down upfront.. But.. once you know how to use the tool in theory it will make your j

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
Very informative and creative reply! Thanks for sharing :]On 10/19/06, Danny Yoo <[EMAIL PROTECTED] > wrote:>> >> file('filename.txt').readlines()[-1]>> >> > Not to hijack the thread, but what stops you from just putting a>> > file.close() after your example line? Which file should file.close()

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
I thought my solution was the easiest.. but I guess everyone skipped it =POn 10/19/06, Kent Johnson <[EMAIL PROTECTED] > wrote:Danny Yoo wrote:>> file('filename.txt').readlines()[-1] Not to hijack the thread, but what stops you from just putting a file.close() after your example line?>

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
ake though. On 10/19/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> I thought my solution was the easiest.. but I guess everyone skipped it =PNo, we didn't skip it,but as we're all programmers here, we showed alternate ways that itcould be done. Your pos

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
More on that.. some of the file I work with are thousands of lines long... one is even 10's of thousands.. so reading the entire thing into ram is MUCH faster then reading line by line with the filestream open. On 10/19/06, Chris Hengge <[EMAIL PROTECTED]> wrote: I dont care for slo

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
Oops, my mistake, I did read your code, as well as all the others and I had your code mixed with another submission. In that case, excellent contribution =DOn 10/19/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> More on that.. some of the file I work with are tho

[Tutor] Best way to replace items in a list.

2006-10-20 Thread Chris Hengge
I'm trying to build a little piece of code that replaces an item in a list. Here is a sample of what I'd like to do.str = "This was replaced"ff item in list:   replace item with str I know I can do list.remove(item), but how do I place str back into that exact location?Is this how / best way?if ite

Re: [Tutor] Best way to replace items in a list.

2006-10-20 Thread Chris Hengge
Will that replace the location? or add to it? Thanks.On 10/20/06, Jason Massey <[EMAIL PROTECTED] > wrote:Why not:if item in list: loc = list.index(item)  list[loc] = strOn 10/20/06, Chris Hengge < [EMAIL PROTECTED]> wrote: I'm trying to build a little piece of code that repl

Re: [Tutor] Best way to replace items in a list.

2006-10-20 Thread Chris Hengge
I like it because it different.. and it reads cleanly... =PAs far as the first occurance.. I'm not concerned about checking extra, because the first occurance is the only one I should ever need. On 10/20/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> I'

Re: [Tutor] My first real python project: LOLLERSKATES

2006-10-20 Thread Chris Hengge
All I can say to this... LOLLERSKATES =DOn 10/20/06, Tracy R Reed <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE-Hash: SHA1I have been a sysadmin for quite a while now and used to do a lot of perl. I haven't done much programming at all in the last couple of yearsbut have been mea

Re: [Tutor] OOP and Python.. a gentle remark

2006-10-25 Thread Chris Hengge
I dont know about the rest of you, but this thread posting from Alan cleared up some fuzzyness I've had about classes. /me is happier using this. instead of self. =DGreat post! On 10/25/06, Alan Gauld <[EMAIL PROTECTED]> wrote: "Asrarahmed Kadri" <[EMAIL PROTECTED]> wrote> Why is it necessary to ex

Re: [Tutor] New to programming and Python

2006-10-26 Thread Chris Hengge
I'm sure I speak for us all when I ask what sort of things are giving you problems? Maybe that would help us point you in the right direction. Good Luck!On 10/25/06, Jorge Azedo <[EMAIL PROTECTED]> wrote: Hi guys ( and gals )I'm totally new to the whole programming scene (I decided to enter itfor

[Tutor] Why is this only catching one occurance?

2006-10-26 Thread Chris Hengge
Here is my code:for unWantedItem in directoryList:    try:    if "hex" in unWantedItem.lower():    if not "bmc" in unWantedItem.lower():   print unWantedItem + " removed!"    directoryList.remove(unWantedItem)This only seem

Re: [Tutor] Why is this only catching one occurance?

2006-10-27 Thread Chris Hengge
Thats for this very humorous reply =DOn 10/26/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> Here is my code:> for unWantedItem in directoryList:> try: > if "hex" in unWantedItem.lower():> if

Re: [Tutor] Why is this only catching one occurance?

2006-10-27 Thread Chris Hengge
I've tried to use your example:for unWantedItem in directoryList[,,-1]:but I get an error:for unWantedItem in directoryList[,,-1]:                     ^SyntaxError: invalid syntax I understand what you are saying to do, and it makes sense, but I'm not sure how to implime

Re: [Tutor] Why is this only catching one occurance?

2006-10-27 Thread Chris Hengge
"Failed to strip excess hex files." On 10/27/06, Chris Hengge <[EMAIL PROTECTED]> wrote: Thats for this very humorous reply =DOn 10/26/06, Luke Paireepinart < [EMAIL PROTECTED]> wrote: Chris Hengge wrote:> Here is my code:> for unWantedItem in directory

[Tutor] VNC library for python

2006-10-28 Thread Chris Hengge
Does this exist? I see projects talking about writing viewers in python, and talking about their flaws or potential, but I've not seen a single library.Thanks. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Using sys.exit()

2006-10-30 Thread Chris Hengge
Try using SPE, I've really liked it for some of extra features inside it like TODO tags that are automanaged. Also, its written in python, so thats kinda  cool factor. It's also free. On 10/30/06, Dick Moores <[EMAIL PROTECTED]> wrote: At 05:06 PM 10/30/2006, Dick Moores wrote:>I'd like to know ho

Re: [Tutor] One million and counting

2006-10-31 Thread Chris Hengge
Very cool! Congrats!On 10/31/06, Alan Gauld <[EMAIL PROTECTED]> wrote: Hi folks,In just thought I'd mention that my web tutor has now passedthe million visitors mark. Thanks to all those on the tutorlist who have paid a visit.Alan GauldAuthor of the Learn to Program web site http://www.freenetpages

Re: [Tutor] How to capture 'Ctrl+c' in Python

2006-11-01 Thread Chris Hengge
Do you by chance know of a way to capture special keys like "Print Screen"?I have a small script to grab all they keycodes, but it doesn't seem to catch several keys on the keyboard. I've got a utility that I'd like to be able to automagically get a screenshot when something goes wrong so I dont ha

[Tutor] str.strip() help

2006-11-01 Thread Chris Hengge
I can't figure out a way to .strip("string")Example might look like this:>>> myStr = "I want to strip my words.">>> print myStr.strip("my")>>> 'I want to strip words.' Thanks. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo

[Tutor] Print Screen

2006-11-02 Thread Chris Hengge
I posted this in a similar thread a few days ago, and no replies so I think it needs its own listing. Anyone know of a way to capture special keys like "Print Screen"?I have a small script to grab all they keycodes, but it doesn't seem to catch several keys on the keyboard. I've got a utility that

  1   2   >