Re: compare list

2005-11-14 Thread Ben Bush
On 11/14/05, Ben Bush <[EMAIL PROTECTED]> wrote: Hijacking Brian's response since my newsserver never god Ben's originalrequest...:I would program this at a reasonably high abstraction level, based on sets -- since you say order doesn't matter, sets are more appropriatethan lists anyway.  For e

Re: Copyright [was Re: Python Obfuscation]

2005-11-14 Thread garabik-news-2005-05
Erik Max Francis <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers wrote: > >> Depends on the country's laws and the exact agreement. > > Work for hire is part of the Berne convention. > According to recent (2003) Slovak copyright law, ONLY the individual authors own the copyright, and they cann

Re: compare list

2005-11-14 Thread Shi Mu
> Hey Ben, > > first, as expected, the other two answers you received are better. :-) > > Sets are much better optimized for things like membership testing than > are lists. I'm not competent to explain why; indeed, I keep > overlooking them myself :-( > > Unfortunately, the indents got screwed up

Re: compare list

2005-11-14 Thread Ben Bush
  Hi Brian, regarding "if item + 1 in list1 and item + 1 in list2:", my understanding is this will check whether the following item in each list is the same. How does the code permit the situation that the order does not matter? For example, for lisA and lisB, the comparison is true and the two lis

Re: about invalid syntax

2005-11-14 Thread Ben Bush
On 11/14/05, adDoc's networker Phil <[EMAIL PROTECTED]> wrote: . maybe you could separate your code into parts { python std, pythonwin-specific},and then use a debugger to know most of the problem sources? (I'm not familiar with pythonwin, I assume it's a superset of python std) . On 11/14/05, Be

Re: best way to discover this process's current memory usage, cross-platform?

2005-11-14 Thread MrJean1
My suggestion would also be to use sbrk() as it provides a high-water mark for the memory usage of the process. Below is the function hiwm() I used on Linux (RedHat). MacOS X and Unix versions are straigthforward. Not sure about Windows. /Jean Brouwers #if _LINUX #include size_t hiwm (void)

Re: compare list

2005-11-14 Thread Brian van den Broek
Ben Bush said unto the world upon 2005-11-14 23:20: > > On 11/14/05, Brian van den Broek <[EMAIL PROTECTED]> wrote: > >>Ben Bush said unto the world upon 2005-11-14 05:51: >> >>>I have four lists: >>>lisA=[1,2,3,4,5,6,9] >>>lisB=[1,6,5] >>>lisC=[5,6,3] >>>lisD=[11,14,12,15] >>>how can I write

Re: XML Tree Discovery (script, tool, __?)

2005-11-14 Thread George Sakkis
I somehow missed this reply posted two weeks ago. <[EMAIL PROTECTED]> wrote: > "Neat, though non-trivial XSLT makes my head spin." > > Well, you don't have to know XSLT at all to use the Examplotron > transform, although I can understand wanting to understand and hack > what you're using. > > "Ju

Re: about invalid syntax

2005-11-14 Thread adDoc's networker Phil
. maybe you could separate your code into parts { python std, pythonwin-specific}, and then use a debugger to know most of the problem sources? (I'm not familiar with pythonwin, I assume it's a superset of python std) .On 11/14/05, Ben Bush <[EMAIL PROTECTED] > wrote:When I run scripts in PythonWin

Re: best way to discover this process's current memory usage, cross-platform?

2005-11-14 Thread Neal Norwitz
Alex Martelli wrote: > > So, I thought I'd turn to the "wisdom of crowds"... how would YOU guys > go about adding to your automated regression tests one that checks that > a certain memory leak has not recurred, as cross-platform as feasible? > In particular, how would you code _memsize() "cross-pl

Re: compare list

2005-11-14 Thread Ben Bush
[snip]That's potentially very expensive for large lists, although simplyconverting the lists to sets should give a significant speed up.  I think the following is *possibly* as good a way as any.>>> def compare(list1, list2):   intersection = sorted(list(set(list1) & set(list2)))   for i i

about invalid syntax

2005-11-14 Thread Ben Bush
When I run scripts in PythonWin, sometimes will get the message of invalid syntax error. How can I check which error I made? For example, in VB, you might got the wrong place highlighted and help message too.-- Thanks!Ben Bush -- http://mail.python.org/mailman/listinfo/python-list

Re: compare list

2005-11-14 Thread Ben Bush
Hijacking Brian's response since my newsserver never god Ben's originalrequest...:I would program this at a reasonably high abstraction level, based on sets -- since you say order doesn't matter, sets are more appropriatethan lists anyway.  For example:def two_cont_in_common(x, y):   common = set(

Re: compare list

2005-11-14 Thread Ben Bush
what does the following code mean?  if item in list2:                        if item + 1 in list1 and item + 1 in list2:  On 11/14/05, Brian van den Broek <[EMAIL PROTECTED]> wrote: Ben Bush said unto the world upon 2005-11-14 05:51:> I have four lists:> lisA=[1,2,3,4,5,6,9] > lisB=[1,6,5]> lisC=[5

Re: Installing tkinter with Python 2.4.2 on FC4

2005-11-14 Thread Paul Watson
Paul Watson wrote: > I cannot yet get tkinter working on 2.4.2. I have installed the tk rpms > from FC4. I have checked to see that TKPATH is available in > Modules/Setup. > > How can I verify that I have tcl/tk installed correctly and it is the > correct version (8+)? Surely, there must be

Re: best way to discover this process's current memory usage, cross-platform?

2005-11-14 Thread Alex Martelli
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Not sure if I should start a new thread or not, but > since this is closely related, I'll just leave it as is. > > Alex Martelli wrote: > > > Having fixed a memory leak (not the leak of a Python reference, some > > other stuff I wasn't properly freei

Re: best way to discover this process's current memory usage, cross-platform?

2005-11-14 Thread Steven D'Aprano
Not sure if I should start a new thread or not, but since this is closely related, I'll just leave it as is. Alex Martelli wrote: > Having fixed a memory leak (not the leak of a Python reference, some > other stuff I wasn't properly freeing in certain cases) in a C-coded > extension I maintain,

Post/View Open Source Jobs

2005-11-14 Thread Superior Staffing Solutions
Post/View Open Source Jobs http://groups.yahoo.com/group/opensourcejobs -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal for adding symbols within Python

2005-11-14 Thread Ben Finney
Björn Lindström <[EMAIL PROTECTED]> wrote: > So, I guess no one read my explanation of why this an issue about > more than implementing enums (which is fairly trivial, as we have > seen). I read it. I see that something more than enums is being asked for. What I don't see is a use case where this

Re: Proposal for adding symbols within Python

2005-11-14 Thread Ben Finney
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Mon, 14 Nov 2005 17:15:04 +0100, Pierre Barbier de Reuille wrote: > > The key point that, I think, you misunderstand is that symbols are > > not *variables* they are *values*. > > Python doesn't have variables. It has names and objects. That seems t

Re: Where can I find an example that uses FTP standard library?

2005-11-14 Thread Grig Gheorghiu
I have some code that looks something like this: from ftplib import FTP ftp = FTP() # connect and login ftp.connect(server_name) ftp.login(user_name, password) cmd = "STOR %s" % filename #"ASCII transfer" l = open(filename) ftp.storlines(cmd, l) #"BIN transfer" l = open(filename, 'rb') ftp.storbi

Re: modifying small chunks from long string

2005-11-14 Thread Steven D'Aprano
Tony Nelson wrote: > >Can I get over this performance problem without reimplementing the > >whole thing using a barebones list object? I though I was being "smart" > >by avoiding editing the long list, but then it struck me that I am > >creating a second object of the same size when I put the modi

Re: Proposal for adding symbols within Python

2005-11-14 Thread Steven D'Aprano
Björn Lindström wrote: > So, I guess no one read my explanation of why this an issue about more > than implementing enums (which is fairly trivial, as we have seen). I read it. I don't see that it is an issue, and I especially don't see why it is relevent to Pierre's usage of symbols. In your

Re: compare list

2005-11-14 Thread Duncan Smith
Brian van den Broek wrote: > Ben Bush said unto the world upon 2005-11-14 05:51: > >> I have four lists: >> lisA=[1,2,3,4,5,6,9] >> lisB=[1,6,5] >> lisC=[5,6,3] >> lisD=[11,14,12,15] >> how can I write a function to compare lisB, lisC and lisD with lisA, >> if they >> share two continuous elements

Re: compare list

2005-11-14 Thread Alex Martelli
Brian van den Broek <[EMAIL PROTECTED]> wrote: > Ben Bush said unto the world upon 2005-11-14 05:51: > > I have four lists: > > lisA=[1,2,3,4,5,6,9] > > lisB=[1,6,5] > > lisC=[5,6,3] > > lisD=[11,14,12,15] > > how can I write a function to compare lisB, lisC and lisD with lisA, if they > > share t

Re: modifying small chunks from long string

2005-11-14 Thread MackS
Thank you all for your great help. One of the few things better than python is the knowledgeable community around it. : ) Regards, Mack -- http://mail.python.org/mailman/listinfo/python-list

best way to discover this process's current memory usage, cross-platform?

2005-11-14 Thread Alex Martelli
Having fixed a memory leak (not the leak of a Python reference, some other stuff I wasn't properly freeing in certain cases) in a C-coded extension I maintain, I need a way to test that the leak is indeed fixed. Being in a hurry, I originally used a q&d hack...: if sys.platform in ('linux2', 'da

Where can I find an example that uses FTP standard library?

2005-11-14 Thread QuadriKev
I am fairly new to programming in Python. There are a number of cases where I would like to see examples of programs written. I like to write them on Windows and in some cases put them on my Linux server to do something useful. I am also interested in using Telnet to check services and things on

Re: circle and point

2005-11-14 Thread Robert Kern
Ben Bush wrote: > is there any python code doing this: > there are two line segments (2x+y-1=0 with the coordinates of two ending > points are (1,-1) and (-1,3); > x+y+6=0 with the coordinates of two ending points are (-3,-3) and > (-4,-2);). They extend and when they meet each other, stop extendin

Re: how to start a process and get it's pid?

2005-11-14 Thread J Correia
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Fredrik Lundh wrote: > > Daniel Crespo wrote: > >>os.spawnl(os.P_NOWAIT, "c:/windows/notepad.exe") > >>>1944 > >> > >>I don't get the correct PID. > >> > >>When I do os.spawnl(os.P_NOWAIT, "c:/windows/notepad.exe") >

Re: Pregunta sobre python

2005-11-14 Thread J Correia
Para Windows: import win32api handle = win32api.OpenProcess(1, False, pid_del_proceso) win32api.TerminateProcess(handle, -1) win32api.CloseHandle(handle) "Yves Glodt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Andres de la Cuadra wrote: > > Hola, me llamo Andres de la cuadra,

Re: compare list

2005-11-14 Thread Brian van den Broek
Ben Bush said unto the world upon 2005-11-14 05:51: > I have four lists: > lisA=[1,2,3,4,5,6,9] > lisB=[1,6,5] > lisC=[5,6,3] > lisD=[11,14,12,15] > how can I write a function to compare lisB, lisC and lisD with lisA, if they > share two continuous elements (the order does not matter), then return

Re: how to convert between type string and token

2005-11-14 Thread Gary Herron
This is not really a Python question, but a question on how to use the nltk package. I've never used, installed nor even seen that package, so of course I can't answer your question, but I do have a suggestion. A quick goggle finds a web page for nltk: http://nltk.sourceforge.net/. Is that where

Re: [Tutor] how to convert between type string and token

2005-11-14 Thread Danny Yoo
On Mon, 14 Nov 2005, enas khalil wrote: > hello all [program cut] Hi Enas, You may want to try talking with NTLK folks about this, as what you're dealing with is a specialized subject. Also, have you gone through the tokenization tutorial in: http://nltk.sourceforge.net/tutorial/tok

Re: more newbie help needed

2005-11-14 Thread Steve Holden
john boy wrote: [top-posting corrected] > > Steve Holden <[EMAIL PROTECTED]> wrote:john boy wrote: > >>using the following program: >> >>fruit = "banana" >>index = 0 >>while index < len (fruit): >>letter = fruit[index-1] >>print letter >>index= index -1 >> >>this program is supposed to spell "ban

how to convert between type string and token

2005-11-14 Thread enas khalil
hello all when i run the code : # -*- coding: cp1256 -*-from nltk.tagger import *from nltk.corpus import brownfrom nltk.tokenizer import WhitespaceTokenizer # Tokenize ten texts from the Brown Corpustrain_tokens = []xx=Token(TEXT=open('fataha2.txt').read())WhitespaceTokenizer().tokenize(xx)f

Re: Searching date and and time from a text file

2005-11-14 Thread davideugenewarren
[EMAIL PROTECTED] wrote: > Hi, I am new in Python programming. Can anybody give me any idea about > how to detect more than one date and time (like 11/11/2005 , > 10-12-2006, 12:30 etc) from a text file and keep them in a list. http://docs.python.org/lib/bltin-file-objects.html http://docs.pytho

Re: Tix BUG? Where to submit?

2005-11-14 Thread Martin v. Löwis
Ron wrote: > Surprising to myself, this was all that it took to make this work. So I'm > not sure why this method was left out. Could it have been an oversight? It could be an oversight. More likely, it was not originally there when the underlying tix library was developed, and only added to t

Re: Parse file into array

2005-11-14 Thread Leif K-Brooks
Leif K-Brooks wrote: > line = line.rsplit('\r\n') Er, that should be line.rstrip, not line.rsplit. -- http://mail.python.org/mailman/listinfo/python-list

Re: Parse file into array

2005-11-14 Thread amfr
Thanks a lot. The webserver I am writing works now :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching date and and time from a text file

2005-11-14 Thread masudtarek
Thanks. It was like 911 -- http://mail.python.org/mailman/listinfo/python-list

Re: Parse file into array

2005-11-14 Thread Leif K-Brooks
amfr wrote: > I was wondering how i could parse the contents of a file into an array. > the file would look something like this: > > gif:image/gif > html:text/html > jpg:image/jpeg > ... > > As you can see, it contains the mime type and the file extension > seperated by commas, 1 per line. I wa

Re: Searching date and and time from a text file

2005-11-14 Thread Daniel Schüle
[EMAIL PROTECTED] wrote: > Hi, I am new in Python programming. Can anybody give me any idea about > how to detect more than one date and time (like 11/11/2005 , > 10-12-2006, 12:30 etc) from a text file and keep them in a list. well first we read the file src = file("/your/file").read() then we

Searching date and and time from a text file

2005-11-14 Thread masudtarek
Hi, I am new in Python programming. Can anybody give me any idea about how to detect more than one date and time (like 11/11/2005 , 10-12-2006, 12:30 etc) from a text file and keep them in a list. -- http://mail.python.org/mailman/listinfo/python-list

Re: Making a persistent HTTP connection

2005-11-14 Thread Alan Kennedy
[David Rasmussen] >> I use urllib2 to do some simple HTTP communication with a web server. >> In one "session", I do maybe 10-15 requests. It seems that urllib2 >> opens op a connection every time I do a request. Can I somehow make it >> use _one_ persistent connection where I can do multiple GET->

Re: Proposal for adding symbols within Python

2005-11-14 Thread Björn Lindström
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Why does the byte string "\x6f\x70\x65\x6e\x65\x64" have intrinsic > meaning when the int 0 doesn't? It certainly doesn't mean anything to > non-English speakers. > > If all you want is human readable byte strings, then just use them: > > class MyFile:

Re: Making a persistent HTTP connection

2005-11-14 Thread Alan Kennedy
[David Rasmussen] >> I use urllib2 to do some simple HTTP communication with a web server. >> In one "session", I do maybe 10-15 requests. It seems that urllib2 >> opens op a connection every time I do a request. Can I somehow make it >> use _one_ persistent connection where I can do multiple GE

Re: Proposal for adding symbols within Python

2005-11-14 Thread Grant Edwards
On 2005-11-14, Rocco Moretti <[EMAIL PROTECTED]> wrote: > >> Please, note that I am entirely open for every points on this proposal >> (which I do not dare yet to call PEP). > > I still don't see why you can't just use strings. Same here. In the situations described, I always use strings and have

Re: Parse file into array

2005-11-14 Thread Craig Marshall
> I was wondering how i could parse the contents of a file into an array. > the file would look something like this: > > gif:image/gif > html:text/html > jpg:image/jpeg Try something like this: d = {} for line in open("input.txt").readlines(): ext, mime = line.strip().split(":") d[ext] = mim

Re: Proposal for adding symbols within Python

2005-11-14 Thread Steven D'Aprano
On Mon, 14 Nov 2005 17:15:04 +0100, Pierre Barbier de Reuille wrote: > The problem is not about having something constant ! > The main point with symbols is to get human-readable values. > Let say you have a symbol "opened" and a symbol "closed". The state of a > file may be one of the two. > > I

Re: more newbie help needed

2005-11-14 Thread Fredrik Lundh
Craig Marshall wrote: > Or, if you're *really* just trying to reverse the string, then the > following might read more easily (although it's probably longer): > fruit = list(fruit) > fruit.reverse() > fruit = ''.join(fruit) same thing, on one line: fruit = "".join(reversed(fruit)) same thi

Parse file into array

2005-11-14 Thread amfr
I was wondering how i could parse the contents of a file into an array. the file would look something like this: gif:image/gif html:text/html jpg:image/jpeg ... As you can see, it contains the mime type and the file extension seperated by commas, 1 per line. I was wondering if it was possible t

Re: Making a persistent HTTP connection

2005-11-14 Thread Benjamin Niemann
Diez B. Roggisch wrote: > David Rasmussen wrote: >> I use urllib2 to do some simple HTTP communication with a web server. In >> one "session", I do maybe 10-15 requests. It seems that urllib2 opens op >> a connection every time I do a request. Can I somehow make it use _one_ >> persistent connecti

Re: Making a persistent HTTP connection

2005-11-14 Thread Diez B. Roggisch
David Rasmussen wrote: > I use urllib2 to do some simple HTTP communication with a web server. In > one "session", I do maybe 10-15 requests. It seems that urllib2 opens op > a connection every time I do a request. Can I somehow make it use _one_ > persistent connection where I can do multiple G

Re: how do i use "tkinter.createfilehandler" with a regular c program?

2005-11-14 Thread Jo Schambach
Thanks, that seems to work. maybe one more question on this subject: how can i use the callback function to the "createfilehandler" call from within a class? in other words, what would be the signature of the callback function, if I made it a member of a class? The documentation says that the cal

Re: Proposal for adding symbols within Python

2005-11-14 Thread Ben Finney
Pierre Barbier de Reuille <[EMAIL PROTECTED]> wrote: > The problem is not about having something constant ! > The main point with symbols is to get human-readable values. > Let say you have a symbol "opened" and a symbol "closed". The state > of a file may be one of the two. from some_enum_mod

Re: how do i use "tkinter.createfilehandler" with a regular c program?

2005-11-14 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, Jo Schambach <[EMAIL PROTECTED]> wrote: >I am trying to write a GUI with tkinter that displays the stdout from a >regular C/C++ program in a text widget. >The idea i was trying to use was as follows: > >1) use "popen" to execute the C/C++ program >2) then use "tkint

Re: Proposal for adding symbols within Python

2005-11-14 Thread Reinhold Birkenfeld
Rocco Moretti wrote: > Pierre Barbier de Reuille wrote: >> Please, note that I am entirely open for every points on this proposal >> (which I do not dare yet to call PEP). > > I still don't see why you can't just use strings. As does Guido. Reinhold -- http://mail.python.org/mailman/listinfo/py

Re: q: console widgets for *nix and windows?

2005-11-14 Thread Grant Edwards
On 2005-11-14, aum <[EMAIL PROTECTED]> wrote: > Can anyone please recommend a widget library for text console, > that works not only on *nix systems but windows /as well/? > > I'm looking for something a bit higher-level than pure curses, > preferably with a gui-like set of widgets, event loop, ha

q: console widgets for *nix and windows?

2005-11-14 Thread aum
Hi, Can anyone please recommend a widget library for text console, that works not only on *nix systems but windows /as well/? I'm looking for something a bit higher-level than pure curses, preferably with a gui-like set of widgets, event loop, handler methods etc. Thanks in advance for your reco

Re: Tix BUG? Where to submit?

2005-11-14 Thread jepler
Since this is a bug in Python (Tix.py), it should be submitted to the Python Patch tracker at sf.net/projects/python You need a free "sourceforge" account to submit an item to the bug or patch tracker. Jeff pgp1zmMFcYHrz.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo

Re: how do i use "tkinter.createfilehandler" with a regular c program?

2005-11-14 Thread jepler
Compared to your program, I * Made sure that the slave program actually flushed its stdout buffers * didn't call read(), which will by default continue reading until it reaches EOF, not merely read the available data #!/usr/bin/env python import sys, time, Tkinter, itertools, _tkinter, os if

Re: SnakeCard products source code

2005-11-14 Thread Philippe C. Martin
I have not tested it with longhorn yet, but it works fine with XP-pro and 2000. Regards, Philippe Kris wrote: > Thanks for sharing it. I am interested in the GINA part. > > > Philippe C. Martin wrote: >> Dear all, >> >> The source code is available in the download section: www.snakecard.com

Re: SnakeCard products source code

2005-11-14 Thread Kris
Thanks for sharing it. I am interested in the GINA part. Philippe C. Martin wrote: > Dear all, > > The source code is available in the download section: www.snakecard.com > > Regards, > > Philippe -- http://mail.python.org/mailman/listinfo/python-list

Re: more newbie help needed

2005-11-14 Thread Fredrik Lundh
Steve Holden wrote: > Note, however, that there are more pythonic ways to perform this task. > You might try: > > for index in range(len(fruit)): > letter = fruit[-index-1] > print letter > > as one example. I'm sure other readers will have their own ways to do > this, many of them more elegan

Re: Python obfuscation

2005-11-14 Thread Mike Meyer
"Ben Sizer" <[EMAIL PROTECTED]> writes: >> It is? Is the Python disassembler so much advanced over the state of >> the art of binary disassemblers, then? Or maybe it's the Python >> decompilers that are so advanced? > Decompyle (http://www.crazy-compilers.com/decompyle/ ) claims to be > pretty adva

Re: more newbie help needed

2005-11-14 Thread Craig Marshall
> Note, however, that there are more pythonic ways to perform this task. > You might try: > > for index in range(len(fruit)): >letter = fruit[-index-1] >print letter Or, if you're *really* just trying to reverse the string, then the following might read more easily (although it's probably

Re: more newbie help needed

2005-11-14 Thread Fredrik Lundh
"john boy" <[EMAIL PROTECTED]> wrote: > using the following program: > > fruit = "banana" > index = 0 > while index < len (fruit): > letter = fruit[index-1] > print letter > index= index -1 > after spelling "banana" it gives an error message: > refering to line 4: letter = fruit[in

Re: more newbie help needed

2005-11-14 Thread Steve Holden
john boy wrote: > using the following program: > > fruit = "banana" > index = 0 > while index < len (fruit): > letter = fruit[index-1] > print letter > index= index -1 > > this program is supposed to spell "banana" backwards and in a vertical > patern...it does thisbut after

Tix BUG? Where to submit?

2005-11-14 Thread Ron
I've been developing a piece of software using Tix. In particular, I'm using the HList widget. I was attempting to use the info_bbox() mentod of that class to get the bounding box of a list entry. I'm using the release version Python 2.4.2. When I look in Tix.py I see that info_bbox() is not

Making a persistent HTTP connection

2005-11-14 Thread David Rasmussen
I use urllib2 to do some simple HTTP communication with a web server. In one "session", I do maybe 10-15 requests. It seems that urllib2 opens op a connection every time I do a request. Can I somehow make it use _one_ persistent connection where I can do multiple GET->"receive data" passes befo

more newbie help needed

2005-11-14 Thread john boy
using the following program:   fruit = "banana" index = 0 while index < len (fruit): letter = fruit[index-1] print letter index= index -1   this program is supposed to spell "banana" backwards and in a vertical patern...it does thisbut after spelling "banana" it gives an error me

Re: Proposal for adding symbols within Python

2005-11-14 Thread Rocco Moretti
Pierre Barbier de Reuille wrote: > Please, note that I am entirely open for every points on this proposal > (which I do not dare yet to call PEP). I still don't see why you can't just use strings. The only two issues I see you might have with them are a) two identical strings might not be identi

Re: Dictionary of tuples from query question

2005-11-14 Thread David Pratt
Thanks Fredrik for your help. Really short and efficient - very nice! Regards, David On Monday, November 14, 2005, at 12:12 PM, Fredrik Lundh wrote: > I meant to write > > d = {} > for index, record in enumerate(cursor.fetchall()): > d[index+1] = tuple(record) > > which can be sh

Re: generate HTML

2005-11-14 Thread Scott David Daniels
Jeffrey Schwab wrote: > [EMAIL PROTECTED] wrote: ... >> def genpage(arg1,arg2): >>print ''' BLAH BLAH.%s %s >> ''' % (arg1, arg2) ... >> i wish to print all these into a HTML output file so that >> when i click on it, it shows me the html page. How can i do that? > ... > Why

Re: replacing multiple instances of commas beginning at specific position

2005-11-14 Thread bruno at modulix
striker wrote: > I have a comma delimited text file that has multiple instances of > multiple commas. Each file will contain approximatley 300 lines. For > example: > > one, two, threefour,fivesix > one, two, three,four,,eighteen, and so on. > > There is one time when multiple

Re: replacing multiple instances of commas beginning at specific position

2005-11-14 Thread Micah Elliott
On Nov 14, striker wrote: > I have a comma delimited text file that has multiple instances of > multiple commas. Each file will contain approximatley 300 lines. > For example: > > one, two, threefour,fivesix > one, two, three,four,,eighteen, and so on. > > There is one time whe

Re: Addressing the last element of a list

2005-11-14 Thread Bengt Richter
On Mon, 14 Nov 2005 09:53:34 -0500, Mike Meyer <[EMAIL PROTECTED]> wrote: >Antoon Pardon <[EMAIL PROTECTED]> writes: >> Op 2005-11-10, Mike Meyer schreef <[EMAIL PROTECTED]>: >>> [Context recovered from top posting.] >>> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: Daniel Crespo wrote: >>>

Re: mp3 wav editing in python

2005-11-14 Thread Daniel Schüle
yb wrote: > Hi, > > Is there a python based tool to cut mp3 and wav file at a start and end > time? I'm looking for a python script that can output a new wav or mp3 > file based on star and endpoint. > > Thank you > there is a wave module >>> import wave >>> dir(wave) ['Chunk', 'Error', 'WA

SnakeCard products source code

2005-11-14 Thread Philippe C. Martin
Dear all, The source code is available in the download section: www.snakecard.com Regards, Philippe -- http://mail.python.org/mailman/listinfo/python-list

how do i use "tkinter.createfilehandler" with a regular c program?

2005-11-14 Thread Jo Schambach
I am trying to write a GUI with tkinter that displays the stdout from a regular C/C++ program in a text widget. The idea i was trying to use was as follows: 1) use "popen" to execute the C/C++ program 2) then use "tkinter.createfilehandler" to create a callback that would be called when the C/C++

replacing multiple instances of commas beginning at specific position

2005-11-14 Thread striker
I have a comma delimited text file that has multiple instances of multiple commas. Each file will contain approximatley 300 lines. For example: one, two, threefour,fivesix one, two, three,four,,eighteen, and so on. There is one time when multiple commas are allowed. Just prio

Re: Not enough arguments for format string

2005-11-14 Thread Pierre Barbier de Reuille
Kevin Walzer a écrit : > I'm getting an error in a Python script I'm writing: "not enough > arguments for format string." The error comes at the end of the > os.system command, referenced below. Any ideas? > > --- > > import EasyDialogs > import os > import sys > > > password = EasyDialogs.AskP

Re: Not enough arguments for format string

2005-11-14 Thread James
Missing a comma there :) On 14/11/05, johnnie pittman <[EMAIL PROTECTED]> wrote: > So the line above should be: > > os.system('open -a X11.app; cd ~/; printenv; DISPLAY=:0.0; export > DISPLAY; echo %s | sudo -S %s; sudo -k' % (password binpath)) > > try that. os.system('open -a X11.app; cd

Re: Not enough arguments for format string

2005-11-14 Thread johnnie pittman
Hey Kevin, I think I see your issue.  So from http://docs.python.org/lib/typesseq-strings.html: If format requires a single argument, values may be a single non-tuple object. Otherwise, values must be a tuple with exactly the number of items specified by the format string, or a single mapping

Not enough arguments for format string

2005-11-14 Thread Kevin Walzer
I'm getting an error in a Python script I'm writing: "not enough arguments for format string." The error comes at the end of the os.system command, referenced below. Any ideas? --- import EasyDialogs import os import sys password = EasyDialogs.AskPassword("To launch Ethereal, please enter yo

Re: Python Book

2005-11-14 Thread Magnus Lycka
David Rasmussen wrote: > What is the best book for Python newbies (seasoned programmer in other > languages)? I think most of the best books have been mentioned, but I thought that I'd add some comments. After all, different people have different ways of learning, and like different book styles.

mp3 wav editing in python

2005-11-14 Thread yb
Hi, Is there a python based tool to cut mp3 and wav file at a start and end time? I'm looking for a python script that can output a new wav or mp3 file based on star and endpoint. Thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: modifying small chunks from long string

2005-11-14 Thread Tony Nelson
In article <[EMAIL PROTECTED]>, "MackS" <[EMAIL PROTECTED]> wrote: > Hello everyone > > I am faced with the following problem. For the first time I've asked > myself "might this actually be easier to code in C rather than in > python?", and I am not looking at device drivers. : ) > > This progr

Re: newbie help needed

2005-11-14 Thread Fredrik Lundh
"john boy" <[EMAIL PROTECTED]> wrote: > I am running the following program: > > def print Multiples (n, high): > i = 1 > while i <= high: > print n*i, ' \t' , > i = i + 1 > print > def printMultTable (high): > i = 1 > while i <= high: > print Multip

Re: Addressing the last element of a list

2005-11-14 Thread [EMAIL PROTECTED]
Bengt Richter wrote: > You may be interested in reviewing > > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/f96b496b6ef14e2/32d3539e928986b3 > > before continuing this topic ;-) Interesting indeed, I mean the argument of why python does it this way. I see the equiva

Webware for Python 0.9 released

2005-11-14 Thread Christoph Zwerschke
Webware 0.9 has been released. Webware for Python is a suite of Python packages and tools for developing object-oriented, web-based applications. The suite uses well known design patterns and includes a fast Application Server, Servlets, Python Server Pages (PSP), Object-Relational Mapping, Tas

How to write an API for a Python application?

2005-11-14 Thread Gary Kshepitzki
Hello I would like to create an API for a piece of Python code. The API is for use by non Python code. It should support interaction in both directions, both accessing functions on the API and the ability for the API to raise events on its clients. What is the best way to do that? I though o

newbie help needed

2005-11-14 Thread john boy
I am running the following program:   def print Multiples (n, high):     i = 1     while i <= high: print n*i, ' \t' , i = i + 1 print def printMultTable (high): i = 1 while i <= high: print Multiples (i, high) i = i + 1 printMultiples(8,8) printMul

Re: Dictionary of tuples from query question

2005-11-14 Thread Fredrik Lundh
David Pratt wrote: > Hi Fredrik. Many thanks for your reply and for the tuple tip. The > cursor.fetchall returns a list of lists in this instance with each list > in the main list containing the field values. With the tip, I > simplified my code to: > > vlist_dict = {} > record_count = 0 > for rec

Re: Proposal for adding symbols within Python

2005-11-14 Thread Pierre Barbier de Reuille
Ben Finney a écrit : > Michael <[EMAIL PROTECTED]> wrote: > >>Ben Finney wrote: >> >>>I've yet to see a convincing argument against simply assigning >>>values to names, then using those names. >> >>If you have a name, you can redefine a name, therefore the value a >>name refers to is mutable. > >

ANN: rest2web 0.4.0alpha

2005-11-14 Thread Fuzzyman
rest2web 0.4.0 alpha is now available. http://www.voidspace.org.uk/python/rest2web/ What's New ? == See http://www.voidspace.org.uk/python/rest2web/reference/changelog.html#version-0-4-0-alpha-2005-11-11 Lots of bugfixes and new features since the 0.3.0 release. Includes a new gallery

screen capture

2005-11-14 Thread py
I need to take a screen shot of the computer screen. I am trying to use PIL and I saw there is ImageGrab...however it only works on Windows. Is there a platform-independent ability to work around this? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: modifying small chunks from long string

2005-11-14 Thread Bengt Richter
On 13 Nov 2005 22:57:50 -0800, "MackS" <[EMAIL PROTECTED]> wrote: >Hello everyone > >I am faced with the following problem. For the first time I've asked >myself "might this actually be easier to code in C rather than in >python?", and I am not looking at device drivers. : ) > >This program is mea

RE: py2exe and pyGTK (was "Error")

2005-11-14 Thread Jimmy Retzlaff
danger wrote: > hi everybody, i have a problem with py2exe that gives me this error: > > ImportError: could not import pango > ImportError: could not import pango > Traceback (most recent call last): > File "acqua.py", line 40, in ? > File "gtk\__init__.pyc", line 113, in ? > AttributeError: '

  1   2   >