print shell output in a file

2006-06-30 Thread Juergen Huber
hello, one more question i will have! now i have written a little programm, which delivers me an output on the shell! here is the print command, which delivers me the following output (see below) on the shell: print '%-30s | %-12d | %-12d |%-12d ' % (typename,

Re: Way for see if dict has a key

2006-06-30 Thread Paul McGuire
"Michele Petrazzo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > when we expect that the key will most often be in my_dict so that > > exception will be raised rarely > > I didn't thought this because if I think that a key aren't in a dict, I > use dict.get(key, default) > Anothe

string replace

2006-06-30 Thread Michele Petrazzo
Hi, a lot of times I need to replace more than one char into a string, so I have to do something like value = "test" chars = "e" for c in chars: value = value.replace(c, "") A solution could be that "replace" accept a tuple/list of chars, like that was add into the new 2.5 for startswith. I d

Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread Luis M. González
Alok wrote: > Luis M. González wrote: > > Alok wrote: > > > I was merely describing my experience and inviting others' response > > > about theirs. > > > > That's exactly what I'm doing. > > You misinterpret, I was talking about my experience with the site and > inviting response from other people

Re: conecting with a MsAcces DB by dao

2006-06-30 Thread Iain King
luis wrote: > Iain King ha escrito: > > > luis wrote: > > > Iain King ha escrito: > > > > > > > luis wrote: > > > > > while not rs.EOF: > > > > > id=rs.Fields(colName.Value) #colName, valid column name > > > > > ... > > > > > rs.MoveNext() > > > > > rs.Close() >

Re: efficiency question

2006-06-30 Thread David Harvey
Fredrik Lundh wrote: > when in doubt, ask the compiler: MTD wrote: > >>> dis.dis(cod) Thanks so much guys! Python just gets cooler every day! David -- http://mail.python.org/mailman/listinfo/python-list

Re: finding the last file created in a directory

2006-06-30 Thread Tim Chase
> I have a repeatedly running process, which always creates a > new logfile with an ending n+1. What I need is to find the > last file, the one with highest number at the end. The problem > is, that the max() method gives me a wrong answer. I tried to > convert the items in my list into integers us

Re[2]: delete first line in a file

2006-06-30 Thread Petr Jakeš
JH> this helps me! JH> thank you very much! JH> greetings, juergen I am happy to see my postings (which I sent by accident to you only, not to the list, see below) helped. But: Its a pity we can not see your solution (your code) here :( It helps to others as well to see, how to solve some

RE: Way for see if dict has a key

2006-06-30 Thread Cihal Josef
If dict.has_key('key'): print dict[''] Josef Cihal -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Georg Brandl Sent: Friday, June 30, 2006 5:07 PM To: python-list@python.org Subject: Re: Way for see if dict has a key Bruno Desthuilliers wrote: >

Re: Way for see if dict has a key

2006-06-30 Thread Georg Brandl
Bruno Desthuilliers wrote: > looping wrote: >> Michele Petrazzo wrote: >> >>>Bruno Desthuilliers wrote: >>> >but what the better Depends on the context. >>> >>>If know only one context: see if the key are into the dict... What other >>>context do you know? >>> >> >> Why do you

Re: list comprehension

2006-06-30 Thread Bruno Desthuilliers
Andy Dingley <[EMAIL PROTECTED]> wrote: > Simon Forman wrote: > > >>There's more to it, but that's the basic idea. > > > This much I knew, but _why_ and _when_ would I choose to use list > comprehension (for good Python style), rather than using a simple > "traditional" loop ? Whenever it's mo

Re: logging error with RotatingFileHandler

2006-06-30 Thread flupke
flupke schreef: > Hi Vinay, > > thanks for the info. > > I tried to change the handlers.py file. > First, i changed some code in doRollover. > > if os.path.exists(dfn): > os.remove(dfn) > try: > #os.rename(self.baseFilename, dfn) > > -> The rename fails for some reason. > > I tried wi

Re: delete first line in a file

2006-06-30 Thread Juergen Huber
this helps me! thank you very much! greetings, juergen JH> Fredrik Lundh wrote: >> Juergen Huber wrote: >> >>> ok...i thought as much, that i have to copy this file! >>> >>> how will i do that?! >>> how will i fix this file => delete the first line?! >>> >>> with which commands cou

Re: Way for see if dict has a key

2006-06-30 Thread Bruno Desthuilliers
Fredrik Lundh wrote: > "André" wrote: > > >>Perhaps Bruno meant this: >> >>try: >> ... my_dict[key] ... >>except: >>... >> >>when we expect that the key will most often be in my_dict so that >>exception will be raised rarely, otherwise use > > > on my machine, "key in dict" is about twice as

finding the last file created in a directory

2006-06-30 Thread Petr Man
Hello everyone, I have a repeatedly running process, which always creates a new logfile with an ending n+1. What I need is to find the last file, the one with highest number at the end. The problem is, that the max() method gives me a wrong answer. I tried to convert the items in my list into in

Re: list comprehension

2006-06-30 Thread Andy Dingley <[EMAIL PROTECTED]>
Simon Forman wrote: > There's more to it, but that's the basic idea. This much I knew, but _why_ and _when_ would I choose to use list comprehension (for good Python style), rather than using a simple "traditional" loop ? If I want to generate something that's simply ( [1] + [2] + [3]+... ) the

Can't connect to Oracle DB via DCOracle2 as sysdba

2006-06-30 Thread Cihal Josef
Hi,   how can I connect please to DB Oracle9i via DCOracle.Connect as SYSDBA?   >>> dbc = DCOracle2.connect(user='', password= ' as sysdba' )u,p2:  sys,'pTraceback (most recent call last):  File "", line 1, in ?  File "C:\Program Files\Python21\lib\DCOracle2\DCOracle2\DCOracle2.py", line 1

Re: Py2exe make wxPython window looks bad

2006-06-30 Thread Andreas Kaiser
zdp schrieb: > But when I convert the program to EXE file by Py2exe, and run it, the > look & feel is bad. It's just like the windows 9x. All controls has a > thick and emboss border. However, the scrollbars look good, same as the > window XP. XP needs a manifest file in the setup.py or as a singl

Re: conecting with a MsAcces DB by dao

2006-06-30 Thread luis
Iain King ha escrito: > luis wrote: > > Iain King ha escrito: > > > > > luis wrote: > > > > while not rs.EOF: > > > > id=rs.Fields(colName.Value) #colName, valid column name > > > > ... > > > > rs.MoveNext() > > > > rs.Close() > > > > conn.Close() > > > >

Re: list comprehension

2006-06-30 Thread Eric S. Johansson
tac-tics wrote: > a wrote: >> can someone tell me how to use them >> thanks > > sigh... > You do a google on them: > > http://docs.python.org/tut/node7.html#SECTION00714 > thank you for the reminder. But after reading it, I was left with a question. Why the new syntax for wha

Re: logging error with RotatingFileHandler

2006-06-30 Thread flupke
Vinay Sajip schreef: > flupke wrote: > >> If this bug is fixed, where will i find a fixed version and how do i >> install it? >> Also, more important to me, what am i doing wrong to get this error >> message in the first place? > > You're not doing anything particularly wrong, though it's not exa

Re: efficiency question

2006-06-30 Thread MTD
For the sake of comparison: >>> def cod(x): ... tupple1 = ("abc", "def", "xyz") ... tupple2 = ("pqr", "tuv", "123") ... if x in tupple1: ... doStuff() ... elif x in tupple2: ... doOtherStuff() ... >>> dis.dis(cod) 2 0 LOAD_CONST 7 (

Re: Way for see if dict has a key

2006-06-30 Thread Bruno Desthuilliers
looping wrote: > Michele Petrazzo wrote: > >>Bruno Desthuilliers wrote: >> but what the better >>> >>>Depends on the context. >>> >> >>If know only one context: see if the key are into the dict... What other >>context do you know? >> > > Why do you want to do that ? > > if key in dict: >

Re: Way for see if dict has a key

2006-06-30 Thread Fredrik Lundh
"André" wrote: > Perhaps Bruno meant this: > > try: >... my_dict[key] ... > except: > ... > > when we expect that the key will most often be in my_dict so that >exception will be raised rarely, otherwise use on my machine, "key in dict" is about twice as fast as the full try/getitem con- stru

Re: Way for see if dict has a key

2006-06-30 Thread looping
Michele Petrazzo wrote: > Bruno Desthuilliers wrote: > >> but what the better > > > > Depends on the context. > > > > If know only one context: see if the key are into the dict... What other > context do you know? > > Michele Why do you want to do that ? if key in dict: value = dict[key] else:

Re: Way for see if dict has a key

2006-06-30 Thread Fredrik Lundh
Michele Petrazzo wrote: >> Michele Petrazzo wrote: >> > key in dict new syntax (2.3 and later). >>> So, following it, it can be used for the operations like len? >> >> what's "it" in this sentence? > > It, is the thought that the new 2.3 introduce. support for "key in dictionary" form wa

Re: Way for see if dict has a key

2006-06-30 Thread Michele Petrazzo
André wrote: > Michele Petrazzo wrote: >> Bruno Desthuilliers wrote: but what the better >>> Depends on the context. >>> >> If know only one context: see if the key are into the dict... What other >> context do you know? >> >> Michele > > Perhaps Bruno meant this: > > try: >... my_dict[k

Re: Interprocess communication on multi-user machine

2006-06-30 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: |> > |> >Sockets are often accessed via special files, but are not files. |> |> They are files. They are not _regular_ files. Sigh. Firstly, look at something like: http://www.opengroup.org/onlinepubs/009695399

Re: delete first line in a file

2006-06-30 Thread Schüle Daniel
Juergen Huber schrieb: > Fredrik Lundh wrote: >> Juergen Huber wrote: >> >>> ok...i thought as much, that i have to copy this file! >>> >>> how will i do that?! >>> how will i fix this file => delete the first line?! >>> >>> with which commands could i do that?! >> start here: >> >> http://docs.pyt

Re: delete first line in a file

2006-06-30 Thread Fredrik Lundh
Juergen Huber wrote: >> start here: >> >> http://docs.python.org/tut/node9.html#SECTION00920 > > that documentation i have already read, but it wouldn`t help me for my > problem! that documentation and a little experimentation should be all you need. > i know, how i can read the

Re: delete first line in a file

2006-06-30 Thread Michele Petrazzo
Juergen Huber wrote: > but...how can i say python, delete the first line?! > thats my problem! You can open the file, read its lines with readlines function ( that return a list), so make your modifies and save to another file. Now, do you know how to work with lists? http://python.org/doc/2.4.

Re: Way for see if dict has a key

2006-06-30 Thread André
Michele Petrazzo wrote: > Bruno Desthuilliers wrote: > >> but what the better > > > > Depends on the context. > > > > If know only one context: see if the key are into the dict... What other > context do you know? > > Michele Perhaps Bruno meant this: try: ... my_dict[key] ... except: ... wh

Re: Way for see if dict has a key

2006-06-30 Thread Michele Petrazzo
Fredrik Lundh wrote: > Michele Petrazzo wrote: > key in dict >>> new syntax (2.3 and later). >> So, following it, it can be used for the operations like len? > > what's "it" in this sentence? > It, is the thought that the new 2.3 introduce. Michele -- http://mail.python.org/mailman/listi

Re: delete first line in a file

2006-06-30 Thread Juergen Huber
Fredrik Lundh wrote: > Juergen Huber wrote: > >> ok...i thought as much, that i have to copy this file! >> >> how will i do that?! >> how will i fix this file => delete the first line?! >> >> with which commands could i do that?! > > start here: > > http://docs.python.org/tut/node9.html#SECTION0092

Re: efficiency question

2006-06-30 Thread Fredrik Lundh
David Harvey wrote: > Suppose I write > > if x in ("abc", "def", "xyz"): > doStuff() > > elif x in ("pqr", "tuv", "123"): > doOtherStuff() > > elif ... > When is python building the tuples? Does it need to build the tuple > every time it comes through this code? Or does it somehow recognise > that

Re: Way for see if dict has a key

2006-06-30 Thread Michele Petrazzo
Bruno Desthuilliers wrote: >> but what the better > > Depends on the context. > If know only one context: see if the key are into the dict... What other context do you know? Michele -- http://mail.python.org/mailman/listinfo/python-list

Re: Way for see if dict has a key

2006-06-30 Thread Fredrik Lundh
Michele Petrazzo wrote: > >> key in dict > > > > new syntax (2.3 and later). > > So, following it, it can be used for the operations like len? what's "it" in this sentence? > len(dict) -> len(dict.keys()) ? len(dict.keys()) is a lousy way to spell len(dict). -- http://mail.python.org/mai

efficiency question

2006-06-30 Thread David Harvey
Hi, Suppose I write if x in ("abc", "def", "xyz"): doStuff() elif x in ("pqr", "tuv", "123"): doOtherStuff() elif ... etc. When is python building the tuples? Does it need to build the tuple every time it comes through this code? Or do

Re: delete first line in a file

2006-06-30 Thread Fredrik Lundh
Juergen Huber wrote: > ok...i thought as much, that i have to copy this file! > > how will i do that?! > how will i fix this file => delete the first line?! > > with which commands could i do that?! start here: http://docs.python.org/tut/node9.html#SECTION00920 -- http://m

Re: Way for see if dict has a key

2006-06-30 Thread Bruno Desthuilliers
Michele Petrazzo wrote: > Hi ng, > what the preferred way for see if the dict has a key? > We have a lot of solutions: > > key in dict > key in dict.keys() > dict.has_key(key) > ... try: dict[key] except KeyError: ... else: ... > but what the better Depends on the context. -- bruno dest

Re: Way for see if dict has a key

2006-06-30 Thread Michele Petrazzo
Fredrik Lundh wrote: > Michele Petrazzo wrote: > >> what the preferred way for see if the dict has a key? >> We have a lot of solutions: >> >> key in dict > > new syntax (2.3 and later). > So, following it, it can be used for the operations like len? len(dict) -> len(dict.keys()) ? Thanks, Mi

Re: conecting with a MsAcces DB by dao

2006-06-30 Thread Iain King
luis wrote: > Iain King ha escrito: > > > luis wrote: > > > while not rs.EOF: > > > id=rs.Fields(colName.Value) #colName, valid column name > > > ... > > > rs.MoveNext() > > > rs.Close() > > > conn.Close() > > > > I don't know if it's the problem your aski

Re: Interprocess communication on multi-user machine

2006-06-30 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Nick Maclaren) wrote: >In article <[EMAIL PROTECTED]>, >Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: >|> In article <[EMAIL PROTECTED]>, >|> Michael Butscher <[EMAIL PROTECTED]> wrote: >|> >|> >Normally any user could connect to an open sock

Re: Way for see if dict has a key

2006-06-30 Thread Chance Ginger
On Fri, 30 Jun 2006 10:19:46 +, Michele Petrazzo wrote: > Hi ng, > what the preferred way for see if the dict has a key? > We have a lot of solutions: > > key in dict > key in dict.keys() > dict.has_key(key) > ... > > but what the better or the more "pythonic"? > > Thanks, > Michele It is

Re: FIXED: Re: optparse multiple arguments

2006-06-30 Thread Ritesh Raj Sarraf
Fredrik Lundh wrote: > Ritesh Raj Sarraf wrote: > > >> http://docs.python.org/lib/optparse-standard-option-actions.html > > > > That won't help because by design of my program, I can't limit the > > number of arguments a user can pass to it. > > do you want options, arguments, or are you just some

Re: delete first line in a file

2006-06-30 Thread Juergen Huber
Fredrik Lundh wrote: > Juergen Huber wrote: > >> i am a dummy user in python and new in this programming language and >> so there will be questions, that´s for you no problem! i never have >> before programmed in any language! sorry for this! i hope you will >> help me, that i also could the basics

Re: Regular Expression - old regex module vs. re module

2006-06-30 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, Steve <[EMAIL PROTECTED]> wrote: >Hi All, > >I'm having a tough time converting the following regex.compile patterns >into the new re.compile format. There is also a differences in the >regsub.sub() vs. re.sub() > >Could anyone lend a hand? > > >import regsub >impor

Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread Tayssir John Gabbour
Kay Schluehr wrote: > Tayssir John Gabbour wrote: > > Supposedly, the Reddit team had a bit of remorse (though of course, we > > should take the following writeup with a grain of salt; maybe there are > > more in-depth sources online): > > "If we could do it all over again, we'd still be using Lisp

image output in matplotlib

2006-06-30 Thread mart_jeeha
Hey folks, I got a problem in printing images from a matplotlib - FigureCanvas Object (child of a wxFrame, library backend_wx) into jpeg-formatted files. (I like to create a sequence of images that I can assemble to an avi) self.mycanvas.print_figure("test.jpg") merely gives an error stating, tha

Re: FIXED: Re: optparse multiple arguments

2006-06-30 Thread Fredrik Lundh
Ritesh Raj Sarraf wrote: >> http://docs.python.org/lib/optparse-standard-option-actions.html > > That won't help because by design of my program, I can't limit the > number of arguments a user can pass to it. do you want options, arguments, or are you just somewhat confused ? -- http://mai

Re: delete first line in a file

2006-06-30 Thread Fredrik Lundh
Juergen Huber wrote: > i am a dummy user in python and new in this programming language and so > there will be questions, that´s for you no problem! i never have before > programmed in any language! sorry for this! i hope you will help me, that i > also could the basics in this language! and later

Re: FIXED: Re: optparse multiple arguments

2006-06-30 Thread Ritesh Raj Sarraf
Simon Percivall wrote: > > It might do you good to read the documentation instead of blindly > experimenting. > > Anyway, > > parser.add_option("", "--my-option", nargs=3) > > http://docs.python.org/lib/optparse-standard-option-actions.html That won't help because by design of my program, I can't

Re: conecting with a MsAcces DB by dao

2006-06-30 Thread luis
Iain King ha escrito: > luis wrote: > > Hi > > I'm using activestate python 2.4 on win xp 2 ed. and Ms Access 2002 > > (reading first http://starship.python.net/crew/bwilk/access.html) > > I have writed the following code > > > > def append_from_Access(self): > >try: > > import ... > >

Re: Way for see if dict has a key

2006-06-30 Thread Fredrik Lundh
Michele Petrazzo wrote: > what the preferred way for see if the dict has a key? > We have a lot of solutions: > > key in dict new syntax (2.3 and later). > key in dict.keys() inefficient and pointless. > dict.has_key(key) old syntax; use for code that needs to be backwards compatible. > but

Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread Kay Schluehr
Tayssir John Gabbour wrote: > Alok wrote: > > "reddit broke (sorry)" > > "looks like we shouldn't have stopped using lisp..." > > > > See screenshot at > > http://photos1.blogger.com/blogger/1773/1980/1600/reddit-broke.jpg > > > > Whether they truly repent not using lisp or otherwise, their site >

Way for see if dict has a key

2006-06-30 Thread Michele Petrazzo
Hi ng, what the preferred way for see if the dict has a key? We have a lot of solutions: key in dict key in dict.keys() dict.has_key(key) ... but what the better or the more "pythonic"? Thanks, Michele -- http://mail.python.org/mailman/listinfo/python-list

Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread Alok
Luis M. González wrote: > Alok wrote: > > I was merely describing my experience and inviting others' response > > about theirs. > > That's exactly what I'm doing. You misinterpret, I was talking about my experience with the site and inviting response from other people about their experience with

Re: Interprocess communication on multi-user machine

2006-06-30 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, Michael Butscher <[EMAIL PROTECTED]> writes: |> |> this is not really Python-specific but I need it for Python. |> |> I'm wanting a method for interprocess communication which is OS- |> independent (sockets would be the normal way to go), but which works if |> mu

Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread Tayssir John Gabbour
Alok wrote: > "reddit broke (sorry)" > "looks like we shouldn't have stopped using lisp..." > > See screenshot at > http://photos1.blogger.com/blogger/1773/1980/1600/reddit-broke.jpg > > Whether they truly repent not using lisp or otherwise, their site > appears to be 3 times slower ... Hi Alok,

Re: Interprocess communication on multi-user machine

2006-06-30 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: |> In article <[EMAIL PROTECTED]>, |> Michael Butscher <[EMAIL PROTECTED]> wrote: |> |> >Normally any user could connect to an open socket on a machine |> >regardless which user established the socket (the user's pr

delete first line in a file

2006-06-30 Thread Juergen Huber
hello, i am a dummy user in python and new in this programming language and so there will be questions, that´s for you no problem! i never have before programmed in any language! sorry for this! i hope you will help me, that i also could the basics in this language! and later many more, so i hope

Re: FIXED: Re: optparse multiple arguments

2006-06-30 Thread Simon Percivall
Ritesh Raj Sarraf wrote: > Ritesh Raj Sarraf wrote: > > I just noticed that the args variable is holding values b and c. > > the args variables comes from: > > (options, args) = parser.parse_args() > > > > I guess I only need to figure out now is why args isn't storing > > argument "a" also... > >

Re: No error while sending via TCP Socket

2006-06-30 Thread Laszlo Nagy
Laszlo Nagy írta: > Ben Sizer írta: > >> Martin Bürkle wrote: >> >> >>> I have writen a programm using TCP sockets. After i get the connection >>> to another socket I cut the Ethernet cable. Then I send a message. >>> The program doesnt raise any exception. Can somebody tell me why and >

Re: No error while sending via TCP Socket

2006-06-30 Thread Laszlo Nagy
Ben Sizer írta: > Martin Bürkle wrote: > >> I have writen a programm using TCP sockets. After i get the connection >> to another socket I cut the Ethernet cable. Then I send a message. >> The program doesnt raise any exception. Can somebody tell me why and >> give me a hint how to get an excepti

Re: Entry Widget problem

2006-06-30 Thread Fredrik Lundh
Marek S. wrote: > def __init__(self): ... >self.c=f.readline() >c1=int(self.c) >self.FieldList=[] >self.FieldList.append(c1) here you add an integer to the list. >def Pola(self,k,icol,irow,DefaultValue): >self.Tab=StringVar() ... >self.FieldLis

Re: Numeric help!

2006-06-30 Thread Sheldon
Carl Banks wrote: > Sheldon wrote: > >Carl Banks wrote: > >> I'm not sufficiently sure this isn't a homework problem, so here's a > >> partial answer. > [snip] > > > > My days as a student is over for the most part. I am learning python on > > my own and Numeric is not properly documented so I am l

Re: No error while sending via TCP Socket

2006-06-30 Thread Laszlo Nagy
Martin Bürkle írta: > Hi NG, > > I have writen a programm using TCP sockets. After i get the connection > to another socket I cut the Ethernet cable. Then I send a message. > The program doesnt raise any exception. Can somebody tell me why and > give me a hint how to get an exception > Okay, l

Entry Widget problem

2006-06-30 Thread Marek S.
Hi, I am new in Python and I have no experience in object-oriented programming. I want to make an easy GUI for my application. What is my problem? I have the data-file like this (file ETab_H1.dan): 16 1 13 10 1 0.9 1.1 1 0 0.0 0.0 0.0 2 14 50 2 0.9 1.1 4 2 0.0 0.0 0.0 3

Re: Py2exe make wxPython window looks bad

2006-06-30 Thread Ben Sizer
zdp wrote: > But when I convert the program to EXE file by Py2exe, and run it, the > look & feel is bad. It's just like the windows 9x. All controls has a > thick and emboss border. However, the scrollbars look good, same as the > window XP. Bear in mind that a lot of WinXP users stick with the ol

Re: No error while sending via TCP Socket

2006-06-30 Thread Ben Sizer
Martin Bürkle wrote: > I have writen a programm using TCP sockets. After i get the connection > to another socket I cut the Ethernet cable. Then I send a message. > The program doesnt raise any exception. Can somebody tell me why and > give me a hint how to get an exception Have you tried waiting

Re: How to get indices of a two dimensional list

2006-06-30 Thread Gerard Flanagan
Gerard Flanagan wrote: > [EMAIL PROTECTED] wrote: > > I have a list > > > > x = [0] * 2 > > x = x * [2] > > x[1,1] = 7 > > > > This gives me the x value > > [[0,0] [0,0] [0,0] [0,7]] > > > > I want to get the indices of the value 7. > > i.e. something like > > i = a.index(max(a)) gives me '1' > >

Re: Interprocess communication on multi-user machine

2006-06-30 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Michael Butscher <[EMAIL PROTECTED]> wrote: >Normally any user could connect to an open socket on a machine >regardless which user established the socket (the user's program, to be >precise). That's not true. On *nix systems, a socket is a file, and is subject

Re: FIXED: Re: optparse multiple arguments

2006-06-30 Thread Fredrik Lundh
Ritesh Raj Sarraf wrote: >> I guess I only need to figure out now is why args isn't storing >> argument "a" also... > > I fixed it, I guess. > > parser.add_option("", "--my-option", dest="my_option", > action="store_true") > > sets my_option to True and the arguments are all stored in the list > "

FIXED: Re: optparse multiple arguments

2006-06-30 Thread Ritesh Raj Sarraf
Ritesh Raj Sarraf wrote: > I just noticed that the args variable is holding values b and c. > the args variables comes from: > (options, args) = parser.parse_args() > > I guess I only need to figure out now is why args isn't storing > argument "a" also... > > Ritesh I fixed it, I guess. parser.a

File naming [was Re: Bug reporting impossible]

2006-06-30 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, "Fredrik Lundh" <[EMAIL PROTECTED]> writes: |> |> > |> Why would you have a file named '' in your current directory? |> > |> > Why would Python search for one? :-) |> > |> > In both cases, the normal answer is "Someone made a mistake" but, if |> > you have a script

Re: optparse multiple arguments

2006-06-30 Thread Ritesh Raj Sarraf
Ritesh Raj Sarraf wrote: > Hi, > > I'm having some minor problems with optparse. I'm just worried that > someone shouldn't say that multiple argument feature isn't implemented > in optpartse. > > How to tackle multiple arguments to an option ? > As far as I dug, I've found that >1 arguments are be

optparse multiple arguments

2006-06-30 Thread Ritesh Raj Sarraf
Hi, I'm having some minor problems with optparse. I'm just worried that someone shouldn't say that multiple argument feature isn't implemented in optpartse. How to tackle multiple arguments to an option ? As far as I dug, I've found that >1 arguments are being ignored. parser.add_option("", "--m

Re: conecting with a MsAcces DB by dao

2006-06-30 Thread Iain King
luis wrote: > Hi > I'm using activestate python 2.4 on win xp 2 ed. and Ms Access 2002 > (reading first http://starship.python.net/crew/bwilk/access.html) > I have writed the following code > > def append_from_Access(self): >try: > import ... > conn = win32com.client.Dispatch(r'ADO

Re: How to get indices of a two dimensional list

2006-06-30 Thread Gerard Flanagan
[EMAIL PROTECTED] wrote: > I have a list > > x = [0] * 2 > x = x * [2] > x[1,1] = 7 > > This gives me the x value > [[0,0] [0,0] [0,0] [0,7]] > > I want to get the indices of the value 7. > i.e. something like > i = a.index(max(a)) gives me '1' > > This only gives me the index in one dimension. Is

Re: String Question

2006-06-30 Thread Iain King
Tim Roberts wrote: > "Iain King" <[EMAIL PROTECTED]> wrote: > > > >You probably want: > > > >s.sendto('\xff'*6 + ('\x%s\x%s\x%s\x%s\x%s\x%s' % (str01, str02, str03, > > sttr04, str05, str06))*16, ('192.168.1.255', 80)) > > You probably should TRY suggestions before you post them. That will get an

Re: Py2exe make wxPython window looks bad

2006-06-30 Thread ray223
zdp wrote: > Dear all: > > I made a window program by wxPython. Split windows, treectrl, listctrl > and textctrl are used. When I program in python, the look & feel of the > window controls are like the windos XP look & feel, with thin and flat > border (My os is window XP). It's natural because,

Re: python for windows internet filter / firewall

2006-06-30 Thread Michele Petrazzo
[EMAIL PROTECTED] wrote: > Greetings, > > I'm interested in a simple content-based internet firewall/filter, > similar to dansguardian (http://dansguardian.org/), Firewall and filter are two things totally separated! - If you want to do something like a "page filtering", like dansguard and s

Py2exe make wxPython window looks bad

2006-06-30 Thread zdp
Dear all: I made a window program by wxPython. Split windows, treectrl, listctrl and textctrl are used. When I program in python, the look & feel of the window controls are like the windos XP look & feel, with thin and flat border (My os is window XP). It's natural because, as I know, wxPython us

Re: Import: Multiple modules with same name

2006-06-30 Thread Fredrik Lundh
Amit Khemka wrote: > But It looked like an overkill, Is there a more elegant and better way > of doing it ? try: path = sys.path[:] sys.path.insert(0, mypath) # or something import mymodule finally: sys.path = path -- http://mail.python.org/mailman/l

Re: Running DocTest on Strings

2006-06-30 Thread notanotheridiot
André wrote: > Paddy wrote: > > notanotheridiot wrote: > > > Hi, > > > I have two strings - a docstring containing doctests and a code string > > > containing code to be tested with those doctests. I've been trying for > > > a day now to run the test without concatenating the two strings, > > > ad

Re: String Question

2006-06-30 Thread Tim Roberts
"Iain King" <[EMAIL PROTECTED]> wrote: > >You probably want: > >s.sendto('\xff'*6 + ('\x%s\x%s\x%s\x%s\x%s\x%s' % (str01, str02, str03, > sttr04, str05, str06))*16, ('192.168.1.255', 80)) You probably should TRY suggestions before you post them. That will get an "invalid \x escape". \x must be f

<    1   2