Re: How to replace a comma

2006-12-18 Thread Hendrik van Rooyen
From: "Lad" <[EMAIL PROTECTED]> wrote: > In a text I need to > add a blank(space) after a comma but only if there was no blank(space) > after the comman > If there was a blank(space), no change is made. > > I think it could be a task for regular expression but can not figure > out the correct re

Re: How to get a substring with variable indices

2006-12-18 Thread Tim Chase
> I have a string named text. I need to extract a substring from it > starting by variable 's' and ending by 'e'. > > text[s:e] generates the following error: > > TypeError: slice indices must be integers or None Your syntax is correct...the error you get back is the clue: either "s" or "e

Re: How to get a substring with variable indices

2006-12-18 Thread Paul Rubin
ÁâÐÝØáÛÐÒ ÏÓÛÞ <[EMAIL PROTECTED]> writes: > text[s:e] generates the following error: > TypeError: slice indices must be integers or None > > How to be? :) s and e both have to be integers or None. Try printing them out just before your slice to see if their values are reasonable. >>> s

Re: convert from date string to epoch

2006-12-18 Thread Stefan Antonelli
Amit Khemka gmail.com> writes: > > Check out timegm function in calendar module. The following function > converts "mm/dd/" formats into epoch value, you can hack it for > your date formats. > > def convertToEpoch(date): > tup = map(int,date.split('/')) > l = (tup[2], tup[0

Re: Good Looking UI for a stand alone application

2006-12-18 Thread Chris Mellon
On 12/17/06, Christophe Cavalaria <[EMAIL PROTECTED]> wrote: > Sandra-24 wrote: > > > On 12/16/06, The Night Blogger <[EMAIL PROTECTED]> wrote: > >> Can someone recommend me a good API for writing a sexy looking (Rich UI > >> like WinForms) shrink wrap application > > > >> My requirement is that th

How to get a substring with variable indices

2006-12-18 Thread Станислав Ягло
Hello all! I have a string named text. I need to extract a substring from it starting by variable 's' and ending by 'e'. text[s:e] generates the following error: TypeError: slice indices must be integers or None How to be? :) Regards, Stanislav Yaglo. -- http://mail.python.org/mailman/l

Re: How to replace a comma

2006-12-18 Thread Jon Clements
Lad wrote: > In a text I need to > add a blank(space) after a comma but only if there was no blank(space) > after the comman > If there was a blank(space), no change is made. > > I think it could be a task for regular expression but can not figure > out the correct regular expression. > Can anyon

Re: How to replace a comma

2006-12-18 Thread Peter Otten
Lad wrote: > In a text I need to > add a blank(space) after a comma but only if there was no blank(space) > after the comman > If there was a blank(space), no change is made. >>> s = "alpha, beta,gamma, delta" >>> ", ".join(t.replace(",", ", ") for t in s.split(", ")) 'alpha, beta, gamma, delta

Re: merits of Lisp vs Python

2006-12-18 Thread Paul Rubin
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > Strictly speaking, only first-class functions are required, and > tail-recursion optimisation is only an implentation detail. Now it's > obvious that when it comes to real-life-size programs, this is a > *very* important detail !-) I don't buy this

creating generic class

2006-12-18 Thread Divya Prakash
Hi, I want to create a generic class to convert ". java " file into xml file (validated against xsd / dtd). What is the best approach to do this with jython or python ? Regards Divya -- http://mail.python.org/mailman/listinfo/python

How to replace a comma

2006-12-18 Thread Lad
In a text I need to add a blank(space) after a comma but only if there was no blank(space) after the comman If there was a blank(space), no change is made. I think it could be a task for regular expression but can not figure out the correct regular expression. Can anyone help, please? Thank you L.

Can a Tkinter GUI check for abort script:

2006-12-18 Thread Michael Yanowitz
Hello: I have successfully implemented a Tkinter GUI which has this (simplified here for explanation): +-+ | filename: [./test3.py] | | | | [Run Script] | +---

connecting webservers through HTTP port using python

2006-12-18 Thread pradeep kumar
hii iam working on socket programming, i've to connect webservers through HTTP port and send/receive data.. so currently i'm installed apache server and trying to connect that server using python. so any tell me how to connect the apache server by python code. give suggestions.. -- http://mail.py

Re: Need Simple Way To Determine If File Is Executable

2006-12-18 Thread Gabriel Genellina
On 17 dic, 19:21, "Roger Upole" <[EMAIL PROTECTED]> wrote: > >> > os.stat(selected)[ST_MODE] & (S_IXUSR|S_IXGRP|S_IXOTH > > >>This will tell you that "x.exe" is executable, even if "x.exe" contains > >> nothing but zeros. > > > Isn't the same with any other recipe, portable or not? Unless the OS

Re: New os.path.exists() behavior - bug or feature?

2006-12-18 Thread Martin v. Löwis
klappnase schrieb: > When I insert a floppy into A: os.path.exists('A:\\') will return True > on Python-2.5, too. > Does anyone know, is this inconsistent behavior a bug or a new feature? Neither, nor. In both cases, the operating system is asked, and gives this answer. However, in the Windows API

Re: Core dump revisited

2006-12-18 Thread Gabriel Genellina
On 17 dic, 07:01, "Sheldon" <[EMAIL PROTECTED]> wrote: > I have a python script that uses a C extention. I keep getting a > recurring problem that causes a core dump a few lines after the C > extention return data back tp python. I tried using pbd and gdb but I Most probably the error is inside t

Re: Metaclass uses?

2006-12-18 Thread Bruno Desthuilliers
Nathan Harmston a écrit : (snip) > Also is there anymore interesting OO stuff that Python has apart from Java. Quite a lot. Everything (well, except statements and expressions...) in Python is an object, including classes, modules and functions, and Python objects are really 'dynamic', ie you ca

Re: merits of Lisp vs Python

2006-12-18 Thread Rob Warnock
<[EMAIL PROTECTED]> wrote: +--- | Paul Rubin wrote: | > [...] There are programs you can write in C but not in Lisp, | > like device drivers that poke specific machine addresses. | | I should assume you meant Common Lisp, but there isn't really any | reason you couldn't | (poke d

Re: parsing a dictionary from a string

2006-12-18 Thread Benjamin Georgi
Fredrik Lundh wrote: > Benjamin Georgi wrote: > >> I could use some help extracting the keys/values of a list of >> dictionaries from a string that is just the str() representation of the >> list (the problem is related to some flat file format I'm using for file >> IO). >> >> Example: >> >>>

Re: merits of Lisp vs Python

2006-12-18 Thread André Thieme
Paul Rubin schrieb: > GC also gets rid of programs. There are programs you can write in C > but not in Lisp, like device drivers that poke specific machine > addresses. You are talking about an ANSI Common Lisp implementation. But nothing stops a vendor to deliver its CL with libs that support t

Re: Dictionary, iterate & update objects

2006-12-18 Thread Bruno Desthuilliers
jansenh a écrit : > hi comp.lang.python. > > I need some newbe advice on idiomatic use of Python dictionaries. > > I have service with a dictionary which holds a bunch of objects as > values, and an ID as key to each object. Then I want to change an > objects state based on its key. class MyObj(

Re: Why there isn't a sort method for array ?

2006-12-18 Thread James Stroud
John Machin wrote: > Tim Roberts wrote: >> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >>> It seems that an array acts like an list very much, except it doesn't >>> have a method sort. >> What do you mean by "array"? There is no such beast in the Python >> language. Do you mean the library mod

Re: Class and instance question

2006-12-18 Thread Bruno Desthuilliers
Marco Wahl a écrit : (snip) > The __new__ method should return the class. s/class/instance/ -- http://mail.python.org/mailman/listinfo/python-list

Re: trees

2006-12-18 Thread Bruno Desthuilliers
Raymond Hettinger a écrit : > vertigo wrote: > >>What library/functions/classes could i use to create trees ? > > > Start with random.seed, login as root, use svn to download the trunk > and branches, when Spring arrives, the leaves will fill-in ;-) keyboard !-) -- http://mail.python.org/mailm

Re: import

2006-12-18 Thread Bruno Desthuilliers
Gert Cuykens a écrit : > I would like to lauch a server from outside the side package directory > how do i specify a path with import http://docs.python.org/tut/node8.html#SECTION00811 (snip) > if __name__ == '__main__': # ??? dont know what is this for When a module is used a

Re: Metaclass uses?

2006-12-18 Thread Michele Simionato
Nathan Harmston wrote: > Hi, > > Recently I posted a question about the factory pattern in python. I ve > implemented this following one of the ideas posted. After some reading > I ve seem a lot of Aspect Oriented Programming mentioned but I m not > really sure what it is. > > Can anyone help me un

Re: merits of Lisp vs Python

2006-12-18 Thread Bruno Desthuilliers
Kaz Kylheku a écrit : > Bruno Desthuilliers wrote: > >>André Thieme a écrit : >> >>>Bruno Desthuilliers schrieb: >>> >> >>(snip) >> Both are highly dynamic. Neither are declarative. >>> >>> >>>Well, Lisp does support some declarative features in the ansi standard. >> >>If you go that way, ther

Re: merits of Lisp vs Python

2006-12-18 Thread Bruno Desthuilliers
Mathias Panzenboeck a écrit : > Bruno Desthuilliers wrote: > >>Mathias Panzenboeck a écrit : >> >>>Rob Thorpe wrote: >>> >>> Mathias Panzenboeck wrote: >Mark Tarver wrote: > > >>How do you compare Python to Lisp? What specific advantages do you >>think that one h

Re: merits of Lisp vs Python

2006-12-18 Thread Bruno Desthuilliers
Paul Rubin a écrit : > "Rob Thorpe" <[EMAIL PROTECTED]> writes: > >>Once you can do the above then you can phrase programs entirely in >>terms of composition of functions, which is what functional programming >>is about. >> >>Getting good performance though is problematic without being able to >>e

Re: Roundtrip SQL data especially datetime

2006-12-18 Thread GHUM
> One side effect of this being third party code is that hosting > services may not have it available, even when they have both Python > and MySQL up. This is never a problem with Perl or PHP, so that's > a negative for Python. I for one think it is a good thing to not have MySQL adapters int

Re: tuple.index()

2006-12-18 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, greg <[EMAIL PROTECTED]> writes: |> Roy Smith wrote: |> |> > The struct does lookup by name, the tuple is inherently index based. |> |> I was trying to help people understand the distinction |> we're talking about by showing an example of the same |> distinction i

Re: first and last index as in matlab

2006-12-18 Thread Evan
Thanks for all the replies, it's much clearer now. -Evan -- http://mail.python.org/mailman/listinfo/python-list

Re: Good Looking UI for a stand alone application

2006-12-18 Thread Peter Decker
On 12/17/06, Luc Heinrich <[EMAIL PROTECTED]> wrote: > > My requirement is that the application needs to look as good on Windows as > > on the Apple Mac > > Crossplatform GUIs are a myth, you *always* end up with a lowest common > denominator (aka Windows) which makes your application look like cr

HTTP or alternative upload for large files

2006-12-18 Thread Jacob Mathew
Hay Robin.. I am Jacob Mathew.. Doing some research in large file uploads for my project. I got your matured skills and ability to do programs for upload huge files. In fact I am a kid in programming, I cannot think to write such a god program. Will you able to share your uploading script with

Re: merits of Lisp vs Python

2006-12-18 Thread Bill Atkins
This is not a response to any particular post, but rather to the general argument that macros are not as useful as we Lispers claim. Here is a fairly complete GUI RSS reader in 90 lines of Lisp (the GUI code itself is 90 lines, but it makes use of some RSS reading/writing code I had laying around

undefined symbol: libxml_xmlDocPtrWrap

2006-12-18 Thread Christian Wenz
Hello, I try to install "listen" on my amd64-gentoo-box. The programm tries to import the gst-package and throws the following trace: Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/gst-0.10/gst/__init__.py", line 108, in ? from _gst

Re: trees

2006-12-18 Thread Raymond Hettinger
vertigo wrote: > What library/functions/classes could i use to create trees ? Start with random.seed, login as root, use svn to download the trunk and branches, when Spring arrives, the leaves will fill-in ;-) Or just use lists as Fredrik suggested. Or look at an example in the cookbook: http://

Re: dealing with special characters in Python and MySQL

2006-12-18 Thread Leo Kislov
ronrsr wrote: > > > > > Try putting "use_unicode=True" in the MySQLdb "connect" call. > > tried that, and also added charset="utf8" - > > now, I can't do any string operations, I get the error msg: > > descriptor 'lower' requires a 'str' object but received a 'unicode' > args = ("descript

Re: dealing with special characters in Python and MySQL

2006-12-18 Thread Fredrik Lundh
ronrsr wrote: > querystring = "update zingers set keywords = '%s', citation = > '%s', quotation = %s' where zid = %d" % > (keywords,citation,quotation,zid) that's not a good way to pass strings to the database. for the right way to do this, see: http://effbot.org/pyfaq/how-do-i-e

Re: dealing with special characters in Python and MySQL

2006-12-18 Thread Fredrik Lundh
ronrsr wrote: > now, I can't do any string operations, I get the error msg: > > descriptor 'lower' requires a 'str' object but received a 'unicode' > args = ("descriptor 'lower' requires a 'str' object but received > a 'unicode'",) what's a "string operation" in this context? are you tryi

Re: Good Looking UI for a stand alone application

2006-12-18 Thread Vincent Delporte
On 17 Dec 2006 21:20:14 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >You could write it as a web app, with an executable which launches the >server and points a browser at it. Right, I was thinking of this too, but since the OP was talking of a fat app... >Python GUI work is a bit of a

<    1   2