"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
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
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
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
[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
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,
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
[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
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
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
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
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
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
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
> "
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
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'
> >
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
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
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
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
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
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
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
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
>
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...
> >
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
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
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,
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
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
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
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
>
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
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 ...
> >
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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:
"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
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:
>
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 (
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
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
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()
> > >
>
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
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
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
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
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
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
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
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
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
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:
>
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
> 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
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
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()
>
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
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
"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
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,
Hi Mechele,
In string s u want to replace string "b" or "c" to -> "x"
import re
s ="a1b2c3"
re.sub("[bc]","x",s)
Sincerely josef
Josef
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Michele Petrazzo
Sent: Friday, June 30, 2006 4:03 PM
To: pytho
> A solution could be that "replace" accept a tuple/list of chars, like
> that was add into the new 2.5 for startswith.
>
> I don't know, but can be this feature included into a future python
> release?
I don't know, but I think it would be useful
as for now I use this
>>> import re
>>> cha
> 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
Thank. But I to solve my problem. On other hand I commented that I
writed a litle program for to send and to recive data from the Serial
Port in byte format, no chars. I wanted publish this GNU program in
brief.
Do you would like to translate to frances?
Thank
--
http://mail.python.org/mailman/li
I don't understand the reason for 'Cookies'. When you are pay to belong to AOL or another network why is it necessary to set up an additional address in order to be able to have access to some information?
We are not all computer talented, even at this date. Some of us only use it for convenienc
In article <[EMAIL PROTECTED]>,
Michele Petrazzo <[EMAIL PROTECTED]> wrote:
>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
It sounds like you want to use print >>
If you have an open object with a "write" property, you can do
print >> thefile, mystring
and Python will simply redirect the output to "thefile" instead of
sys.stdout.
--
http://mail.python.org/mailman/listinfo/python-list
f = file('output.txt','w')
print >>f, '%-30s | %-12d | %-12d |%-12d ' % (typename,
size / count,
count,
size)
f.close()
> hello,
>
> one more question i will
"Steve" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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?
>
>
Not an re so
On 2006-06-30, Martin Bürkle <[EMAIL PROTECTED]> 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
Because send() has successfull
Gnosis (http://gnosis.cx/download/) is able to do this if you mean
something like pickling, but with an XML-like ouput.
--
http://mail.python.org/mailman/listinfo/python-list
Here is my version:
Python 2.4.3 (#2, May 9 2006, 21:56:54)
[GCC 3.4.4 [FreeBSD] 20050518] on freebsd6
I am trying the classes example from the tutorial because some other
class related stuff I am doing is not working either.
Straight from Chapter 9:
class MyClass:
"A simple example class
hello,
if i would type in your code, i became the following output in the
"output.txt" - file
BOOL | 4 | 50463|201852
but why?!
he wouldn´t do that for all the entrys in the csv file! but only for the
first one in the file!
Stephan Wassipaul wrote:
> f = file('output.txt','w'
> class MyClass:
> "A simple example class"
> i = 12345
> def f(self):
> return 'hello world'
>
>
> From here I run:
> x = MyClass
Did you mean x = MyClass()
> xf = x.f
> while True:
>print xf()
>
> This gives the following error:
>
> Traceback (most r
1 - 100 of 186 matches
Mail list logo