In message , Gilles Ganault
wrote:
> test = "t...@gmail.com"
> isp = ["gmail.com", "yahoo.com"]
> for item in isp:
> if test.find(item):
> print item
> === output
> gmail.com
> yahoo.com
> ===
This is why conditional constructs should not accept any values other than
True and False.
--
On Apr 8, 12:08 pm, David Smith wrote:
> Avi wrote:
> > Hi,
>
> > This will be a very simple question to ask all the awesome programmers
> > here:
>
> > How can I get answer in in decimals for such a math operator:
>
> > 3/2
>
> > I get 1. I want to get 1.5
>
> > Thanks in advance,
> > Avi
>
> I'm
In message , Aahz wrote:
> In article
> <637028a0-58b9-4912-896d-2b17e1341...@q16g2000yqg.googlegroups.com>,
> joeygartin wrote:
>>
>> So I was hoping there was a way to spin off the process and
>>redirect the user to the page while the emails are being formed and
>>sent vs. making the page hang
On Apr 7, 12:40 am, Peter Otten <__pete...@web.de> wrote:
> Peter Otten wrote:
> > MooMaster wrote:
>
> >> Now we can't calculate a meaningful Euclidean distance for something
> >> like "Iris-setosa" and "Iris-versicolor" unless we use string-edit
> >> distance or something overly complicated, so i
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512
pxyser --- python xml serialization (release candidate 0.2).
pyxser is a C written extension that serializes/deserializes
python objects in XML format. pyxser is licensed under LGPLv3
and tries to conform a normalized form of object serialization.
On Apr 6, 10:43 pm, Carl Banks wrote:
> MooMaster wrote:
> > So I'm reading in values from a file, and for each column I need to
> > dynamically discover the range of possible values it can take and
> > quantize if necessary. This is the solution I've come up with:
>
> >
> > def createInitialClus
In article <49dcc2df$0$29421$4c5ec...@fe1.usenet.com>,
Jim Garrison wrote:
>
>I emailed the webmaster but have received no response.
Several people have sent e-mail about this; sorry, we haven't had time
for individual responses.
--
Aahz (a...@pythoncraft.com) <*> http://www.p
On Wed, Apr 8, 2009 at 11:10 PM, Ken wrote:
> I need a read-write-lock, is there already an implementation in the standard
> library?
No, but there are several recipes on ActiveState:
http://code.activestate.com/recipes/413393/
http://code.activestate.com/recipes/502283/
http://code.activestate.c
I need a read-write-lock, is there already an implementation in the standard
library?
--
http://mail.python.org/mailman/listinfo/python-list
Michael Torrie wrote:
> Tim Wintle wrote:
> > On Fri, 2009-04-03 at 14:58 -0600, Michael Torrie wrote:
> >> Oh wow. If this is what Twitter does to one's ability to articulate
> >> clearly, I hope Twitter dies a horrible death and any APIs and Python
> >> bindings with it!
> >
> > Thank you, tha
Emma Li wrote:
Hello,
I'm trying to do compression/decompression of stuff with zlib, and I
just don't get it... Here is an example
Try this:
import zlib
compressor = zlib.compressobj(6) # level
cmpr = compressor.compress("a")
print "compressed: %d %r" % (len(cmpr), cmpr)
bit late here, but if it's as simple as you say, i think it would be much
more efficient (because you only scan checklist and alist once each) to
do:
known = set()
for check in checklist:
known.add(check[0:-1])
missing = filter(lambda alpha: alpha not in known, alist)
andrew
PK wrote:
> Exce
Sorin Schwimmer wrote:
> /usr/local/lib is in /etc/ld.so.conf. The files are real. However,
> creating symlinks in /usr/lib targeting the libraries in /usr/local/lib,
> then recompiling, solved the tkinter problem. So, the conclusion is that
> only /usr/lib is consulted for the tcl/tk libraries.
On Wed, 2009-04-08 at 23:51 +0200, Emma Li wrote:
> Hello,
>
> I'm trying to do compression/decompression of stuff with zlib, and I
> just don't get it...
> Here is an example. I assume that dec should be "a", but it isn't. dec
> turns out to be an empty string, and I don't understand why...
>
On Apr 8, 8:44 pm, Piet van Oostrum wrote:
> > "tleeuwenb...@gmail.com" (tc) wrote:
> >tc> What, exactly, needs to be in place for an object to be a valid
> >tc> dictionary key?
>
> It must have __hash__ and __cmp__ or __eq__ methods. Newstyle classes
> inherit these from object.
> --
> Piet
Excellent! Thanks all. Since I need to have this running on python 2.4 as
well, I think I'll choose,
for alpha in alist:
for xy in xlist:
if alpha+xy in checklist:
break
else:
missing.append(alpha)
jus tested and worked like a charm.
Appreciate your help!!
On W
In message <756dl.102831$ur4.35...@en-nntp-09.dc1.easynews.com>, Joel
Koltner wrote:
> If you want to emphasize web usage, I'd be tempted to show them a bit of
> HTML and then introduce them to CGI-bin scripts... written in Python.
Yes, and show them how to watch /var/log/apache2/error.log to fi
Quoting PK :
> So I'm trying to see whats the cleanest way to do this:
>
> I have a
>
> checklist = [ax, bx, by, cy ..] (a combination of a,b,c with x and y,
> either both on one)
>
> allist = [a,b,c,]
> xlist = [x, y, ..]
>
[...]
> now the problem is I want to include alpha in missing l
Hello,
I'm trying to do compression/decompression of stuff with zlib, and I
just don't get it...
Here is an example. I assume that dec should be "a", but it isn't. dec
turns out to be an empty string, and I don't understand why...
===
import zlib
compressor = zlib.compressob
Thank you very much for your help Martin, now I got it.
Cheers,
RC
On 9 abr, 00:05, "Martin v. Löwis" wrote:
> > The issue is that all PyUnicode* functions are returning PyObjects.
> > PyString_AsString return value was char*. Is there any real equivalent
> > of this function?
>
> Ah, right. Py
On Apr 8, 2:15 pm, PK wrote:
> So I'm trying to see whats the cleanest way to do this:
>
> I have a
>
> checklist = [ax, bx, by, cy ..] (a combination of a,b,c with x and y,
> either both on one)
>
> allist = [a,b,c,]
> xlist = [x, y, ..]
>
> now I wanna loop through alist and xlist and see i
> The issue is that all PyUnicode* functions are returning PyObjects.
> PyString_AsString return value was char*. Is there any real equivalent
> of this function?
Ah, right. PyString_AsUTF8String returns a bytes object, to which you
need to apply PyBytes_AsString to. At the end, you need to decref
Sorry but it did not help... I tried this:
PyObject* key = PyList_GetItem(moduleKeys,idx);
char* theKeyName = PyUnicode_AsUTF8String( key );
And this, just in case:
PyObject* key = PyList_GetItem(moduleKeys,idx);
char* theKeyName = PyUnicode_AsUTF8String( PyObject
[Miles]
> I assume that "smallish values of n" refers to the fact that
> itertools.tee places items into every generator's internal deque,
> which islice then skips over, whereas your version places items only
> into the deque of the generator that needs it.
The pure python equivalent listed in th
PK wrote:
So I'm trying to see whats the cleanest way to do this:
I have a
checklist = [ax, bx, by, cy ..] (a combination of a,b,c with x and y,
either both on one)
Since you will be repeatedly looking for items in checklist, I suggest
making it a set instead.
allist = [a,b,c,]
xlist
> PyObject* key = PyList_GetItem(moduleKeys,idx);
> PyObject* module = PyDict_GetItem( interp->modules, key );
> char* theKeyName =
> PySys_WriteStdout("Module '%s'\n", theKeyName);
> }
> I was not able to obtain theKeyName, knowing that the "key" PyObject
> is
Terry Reedy wrote:
Esmail wrote:
Hello,
Anyone using Python for coding up genetic algorithms? If
so, would you share your favorite modules/libraries/tools?
Search 'Python genetic algorithm' on Google or elsewhere.
Hi Terry,
I did that first, and I came up with a number of hits. The "proble
R. David Murray wrote:
Esmail wrote:
Hello Mohammed,
Yes, that would great. While I am comfortable with GAs,
I'm still rather inexperienced with Python so seeing some
implementation examples would be very useful.
A google for 'python genetic algorithms' turns up a number
of interesting hits.
Esmail wrote:
Hello,
Anyone using Python for coding up genetic algorithms? If
so, would you share your favorite modules/libraries/tools?
Search 'Python genetic algorithm' on Google or elsewhere.
--
http://mail.python.org/mailman/listinfo/python-list
Hi everybody,
I'm doing some experiments with the python 3.0 C API, and I'm having
some problems for obtaining character strings. In python 2.X APIs, a
function called PyString_AsString was available. This function
provided a C string (char*) given a PyObject. But, in python 3.0 API
there is no su
So I'm trying to see whats the cleanest way to do this:
I have a
checklist = [ax, bx, by, cy ..] (a combination of a,b,c with x and y,
either both on one)
allist = [a,b,c,]
xlist = [x, y, ..]
now I wanna loop through alist and xlist and see if the combination
exists in checklist
so someth
On Wed, Apr 8, 2009 at 1:21 PM, pataphor wrote:
> On Wed, 08 Apr 2009 10:51:19 -0400 Neal Becker wrote:
>
>> What was wrong with this one?
>>
>> def demux(iterable, n):
>> return tuple(islice(it, i, None, n) for (i, it) in
>> enumerate(tee(iterable, n)))
>
> Nothing much, I only noticed after p
HIi everyone.
i was using python/c api to call a python function from c and I know the
name of the function which i want to call.Is there any way to do that??
This is the method i tried...
for eg:This is the python function i wants to call.
>>>def add(x):
... return x+10
This is my code i
On Wed, 2009-04-08 at 01:57 +0100, Rhodri James wrote:
> On Tue, 07 Apr 2009 12:46:18 +0100, J. Clifford Dyer
> wrote:
>
> > On Mon, 2009-04-06 at 23:41 +0100, Rhodri James wrote:
> >> On Mon, 06 Apr 2009 23:12:14 +0100, Anish Chapagain
> >> wrote:
> >>
> >> > Hi,
> >> > I was trying to extrac
On Mon, 06 Apr 2009 07:37:19 -0700, grkuntzmd wrote:
> What would be a good book to use as the text for the course?
"Python Programming: An Introduction to Computer Science"
Franklin, Beedle & Associates, by little Johny Zelle.
Accept no substitues!
Jim
--
http://mail.python.org/mailman/listinf
Hello again,
/usr/local/lib is in /etc/ld.so.conf. The files are real. However,
creating symlinks in /usr/lib targeting the libraries in /usr/local/lib,
then recompiling, solved the tkinter problem. So, the conclusion is that
only /usr/lib is consulted for the tcl/tk libraries.
multiprocessing -
Cameron Simpson wrote:
> On 07Apr2009 10:08, akineko wrote:
>| I'm trying to use named pipes to fuse a Python program and a C
>| program.
>| One side creates pipes using os.mkfifo() and both sides use the same
>| named pipes (one side reads, another side writes). The read side uses
>| select.sel
On Wed, Apr 8, 2009 at 11:28 AM, Jim Garrison wrote:
> Jim Garrison wrote:
>
>> Ye Liu wrote:
>>
>>> On Apr 6, 6:33 pm, Jim Garrison wrote:
>>>
I notice the online docs (at docs.python.org/3.0/index.html) were
updated today. It seems some of the top-level pages, like
Tutorial, "U
In article <637028a0-58b9-4912-896d-2b17e1341...@q16g2000yqg.googlegroups.com>,
joeygartin wrote:
>
>I am working with Django and I have to send off a number of emails
>after a person has filled out a form. What I want is to make a call
>that goes off to form and send the emails and redirect the
hello
i recently tried out this new version of psyco...
http://www.voidspace.org.uk/python/weblog/arch_d7_2009_03_14.shtml#e1063
...because of the new support for generators. the above link says "To
use and test generators, create preferences.py, following the
instructions in setup.py" - exce
> I see how it avoids needing to look at the parent node in general, but
> if we were compiling by recursively descending through the AST, then
> we would know whether Name's would be loads or stores by the time we
> got to them (we would already had to have visited an encompassing
> assignment or
I taught myself Python from Python Programming for the Absolute
Beginner by Michael Dawson (which has been mentioned above) and with
lots of help from the friendly members of this group, but there's now
a free e-book titled Snake Wrangling for Kids by Jason Briggs. You can
view it at http://www.bri
On Wed, Apr 08, 2009 at 09:03:00PM +0200, paul wrote:
> I'd say you can use:
Thanks. I could hardly ask for a faster response on a
HowTo than this!
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
Dale Amon schrieb:
There are a number of things which I have been used
to doing in other OO languages which I have not yet
figured out how to do in Python, the most important
of which is passing method names as args and inserting
them into method calls. Here are two cases I have been
trying to fi
On Wed, 2009-04-08 at 19:47 +0100, Dale Amon wrote:
> There are a number of things which I have been used
> to doing in other OO languages which I have not yet
> figured out how to do in Python, the most important
> of which is passing method names as args and inserting
> them into method calls. He
There are a number of things which I have been used
to doing in other OO languages which I have not yet
figured out how to do in Python, the most important
of which is passing method names as args and inserting
them into method calls. Here are two cases I have been
trying to figure out for a curren
"Lawrence D'Oliveiro" wrote in message
news:grhq75$eb...@lust.ihug.co.nz...
> I thought that a good introduction might be to show them how HTML works, and
> progress from there to embedding little bits of JavaScript.
>
> Nothing to do with Python I know, but might be a possibility.
If you want t
> Anyway, this person also posted on mod_python list. One of the things
> I highlighted there was that mod_python for some configurations is
> multithreaded and as such they may not be properly protecting
> variables if they are storing them at global scope. They haven't
> responded to any comments
Hi,
joeygartin wrote:
Complete newbie, so forgive my improper use of Python terminology.
I am working with Django and I have to send off a number of emails
after a person has filled out a form. What I want is to make a call
that goes off to form and send the emails and redirect the user to
ano
TP wrote:
> If "di" is reliable, it seems a good solution for my initial constraint
> which is the impossibility to store anything but strings in my data
> structure.
'di' is dangerous and not reliable. When the original object is freed,
then the memory address may be used by another Python object
Baris Demir wrote:
Stef Mientki wrote:
Baris Demir wrote:
Hi all,
I need to develop a GUI for some scientific data processing
operations and this GUI should work well with a 3D plotting module,
also with NumPy and SciPy for sure. I made a search about packages
but, there are plenty of these
On Wed, 08 Apr 2009 10:51:19 -0400
Neal Becker wrote:
> What was wrong with this one?
>
> def demux(iterable, n):
> return tuple(islice(it, i, None, n) for (i, it) in
> enumerate(tee(iterable, n)))
Nothing much, I only noticed after posting that this one handles
infinite sequences too. For
Grant Edwards wrote:
> Apparently that "filtering out" characters doesn't mean that
> they're ignored when doing the comparison. (A bit of a "WTF?"
> if you ask me). After some more googling, it appears that I'm
> far from the first person who interpreted "filtered out" as
> "ignored when compa
Sorin Schwimmer wrote:
>
> Thanks for the pointers.
>
> Here are some answers:
>
> > Ok, so DBM wasn't built because it couldn't find the external symbol
> > 'dbm_firstkey'. I have no idea off the top of my head why that would
> > happen, but I don't think you really care at the moment since y
Avi wrote:
> Hi,
>
> This will be a very simple question to ask all the awesome programmers
> here:
>
> How can I get answer in in decimals for such a math operator:
>
> 3/2
>
> I get 1. I want to get 1.5
>
> Thanks in advance,
> Avi
I'm going to assume your operands are variables instead of
Stef Mientki wrote:
Baris Demir wrote:
Hi all,
I need to develop a GUI for some scientific data processing
operations and this GUI should work well with a 3D plotting module,
also with NumPy and SciPy for sure. I made a search about packages
but, there are plenty of these modules available.
Correction: the UserString will be dead on the final line. When I
typed
it in I had a strong reference still hanging around.
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 7, 11:39 pm, Lawrence D'Oliveiro wrote:
> In message , Steve
>
> Holden wrote:
> > Lawrence D'Oliveiro wrote:
>
> >> In message <7dd228af-
> >> e549-444d-8623-11e951851...@y9g2000yqg.googlegroups.com>, janus99 wrote:
>
> >>> I messed around with my own comp (windos xp) command prompt ...
>
Complete newbie, so forgive my improper use of Python terminology.
I am working with Django and I have to send off a number of emails
after a person has filled out a form. What I want is to make a call
that goes off to form and send the emails and redirect the user to
another view. I have this w
> I don't know what is the best:
> * using an additional dict and maintaining it
It works, but as you say, is somewhat inelegant.
> * or using the "di" module proposed by CTO
Let me be clear: I am not proposing that you use it. It *does* do what
you
ask- but what you are asking is, all by itself
>
> In python2.6 and 3.x, the new behavior is standard.
Apparently that is nonsense - it seems to be not standard for 2.6. Which
Makes sense I guess.
Diez
--
http://mail.python.org/mailman/listinfo/python-list
MRAB wrote:
> You could create a dict with the string as the key and the object as the
> value.
Thanks. But it implies an additional data structure: a dictionnary.
I don't know what is the best:
* using an additional dict and maintaining it
* or using the "di" module proposed by CTO
If "di" is r
"Jim Garrison"
> Jim Garrison wrote:
> > Ye Liu wrote:
> >> On Apr 6, 6:33 pm, Jim Garrison wrote:
> >>> I notice the online docs (at docs.python.org/3.0/index.html) were
> >>> updated today. It seems some of the top-level pages, like
> >>> Tutorial, "Using Python", "Language Reference" are tru
Esmail wrote:
> Hello Mohammed,
>
> Yes, that would great. While I am comfortable with GAs,
> I'm still rather inexperienced with Python so seeing some
> implementation examples would be very useful.
A google for 'python genetic algorithms' turns up a number
of interesting hits.
I also remember
> You could create a dict with the string as the key and the object as the
> value.
This will create a strong reference to the object, which is (I'm
assuming) undesired behavior.
--
http://mail.python.org/mailman/listinfo/python-list
Avi wrote:
> Hi,
>
> This will be a very simple question to ask all the awesome programmers
> here:
>
> How can I get answer in in decimals for such a math operator:
>
> 3/2
>
> I get 1. I want to get 1.5
You don't say which python-version you have. Depending on that, the answer
is different.
On 2009-04-08, Grant Edwards wrote:
> I'm trying to use difflib to compare strings ignoring changes
> to white-space (space/tab). According to the doc page, you
> can do this by specifying a "charjunk" parameter to filter out
> characters:
>
>charjunk: A function that accepts a character (a
TP wrote:
Hi everybody,
I have a data structure (a tree) that has one constraint: I can only store
strings in this data structure.
To know if an object foo already exists in memory, I store "str(id(foo))" in
the data structure.
OK.
But how do I get a usable reference from the id value?
For exa
TP wrote:
Hi everybody,
I have a data structure (a tree) that has one constraint: I can only store
strings in this data structure.
To know if an object foo already exists in memory, I store "str(id(foo))" in
the data structure.
OK.
But how do I get a usable reference from the id value?
For exa
> But how do I get a usable reference from the id value?
> For example, if "foo" has a method "bar()", how can I call "foo.bar()"
> from "str(id(foo))" (say, 149466208).
can you just use a weakref instead? It is certainly cleaner than
trying to store id's,
since an id is only guaranteed to be uniq
On Wed, Apr 8, 2009 at 9:03 AM, Avi wrote:
> Hi,
>
> This will be a very simple question to ask all the awesome programmers
> here:
>
> How can I get answer in in decimals for such a math operator:
>
> 3/2
>
> I get 1. I want to get 1.5
Add the following line to the top of your program (or use Py
Hi,
This will be a very simple question to ask all the awesome programmers
here:
How can I get answer in in decimals for such a math operator:
3/2
I get 1. I want to get 1.5
Thanks in advance,
Avi
--
http://mail.python.org/mailman/listinfo/python-list
I'm trying to use difflib to compare strings ignoring changes
to white-space (space/tab). According to the doc page, you can
do this by specifying a "charjunk" parameter to filter out
characters:
charjunk: A function that accepts a character (a string of
length 1), and returns if the charac
Hi everybody,
I have a data structure (a tree) that has one constraint: I can only store
strings in this data structure.
To know if an object foo already exists in memory, I store "str(id(foo))" in
the data structure.
OK.
But how do I get a usable reference from the id value?
For example, if "fo
Hello Mohammed,
Yes, that would great. While I am comfortable with GAs,
I'm still rather inexperienced with Python so seeing some
implementation examples would be very useful.
Thanks,
Esmail
--
Date: Wed, 8 Apr 2009 17:08:48 +0200
Subject: Re: genetic algorithms in Python?
From: medmedi...@gma
Jim Garrison wrote:
Ye Liu wrote:
On Apr 6, 6:33 pm, Jim Garrison wrote:
I notice the online docs (at docs.python.org/3.0/index.html) were
updated today. It seems some of the top-level pages, like
Tutorial, "Using Python", "Language Reference" are truncated
after the first few paragraphs.
Y
On Apr 7, 1:44 pm, Tim Chase wrote:
> > f = urllib.urlopen("http://www.google.com";)
> > s = f.read()
>
> > It is working, but it's returning the source of the page. Is there anyway I
> > can get almost a screen capture of the page?
>
> This is the job of a browser -- to render the source HTML. A
Thanks for the pointers.
Here are some answers:
> Ok, so DBM wasn't built because it couldn't find the external symbol
> 'dbm_firstkey'. I have no idea off the top of my head why that would
> happen, but I don't think you really care at the moment since you are
> trying to get tkinter working.
I have done something in this direction. I will be happy to share my
experience. However, my code is not generic and needs many things to be
manually introduced. My GA is standard (selection by roulette wheel or
tournament, single point cross). Let me know if you are interested!
On Wed, Apr 8, 200
On Apr 5, 12:24 pm, a...@pythoncraft.com (Aahz) wrote:
> [posted & e-mailed, please respond on-group]
There was some problem with the CGIXMLRPCRequestHandler code in the
SimpleXMLRPC Server.
It was not getting the length to read from the CONTENT_LENGTH
environement variable ( as it the CGI server
Hello,
I'm trying to implement something very simple without using a Python
WebFramework and I need some advice. I want to send a comma delimited string
from the client to a server-side Python script. My initial plan was to use a
JavaScript function (see below) called "makerequest" that creates a
pataphor wrote:
> On 07 Apr 2009 02:05:59 GMT
> Steven D'Aprano wrote:
>
>> The demuxer can't be an iterator, since it needs to run through the
>> entire collection.
>
> Then your demuxer obviously cannot handle infinite sequences.
>
>> def demux(it, n):
>> collectors = [[] for i in xrang
Never mind (at least tentatively).
Later in the day I got an email from the publisher,
saying they're going to send me a corrected copy
"free".
Evidently if you get a bad copy you don't have to complain
to the publisher or the retailer, you just have to post
a complaint somewhere where Google can
On Apr 7, 3:18 pm, Adam Olsen wrote:
> On Apr 6, 3:02 pm, George Sakkis wrote:
>
> > For example, it is common for a function f(x) to expect x to be simply
> > iterable, without caring of its exact type. Is it ok though for f to
> > return a list for some types/values of x, a tuple for others an
On 2009-04-08, Gabriel Genellina wrote:
>>> class Mixin: # or class Mixin(object) if new-style:
>>> def __eq__(self, other):
>>> return (self.type == other.type ...
>>> def __ne__(self, other):
>>> return not self.__eq__(other)
>>> class Fanc
On 2009-04-08, Gabriel Genellina wrote:
>>> ClientForm.Control = FancyControl
>>> ClientForm.CheckboxControl = FancyCheckboxControl
>>
>> That would work -- but there are probably 8 or 10 different
>> Control subclasses. It's a bit tedious mixing them all one at a
>> time, and you need
Sorin Schwimmer wrote:
>
> I wanted to replace my old Python 2.4 and tcl/tk 8.4 with tcl/tk 8.5.6 and
> Python 2.6, mainly so that I can enjoy ttk. tcl/tk was installed from sources
> without any problem, I started a wish and worked.
>
> Now, for the Python, here are all the issues signaled by
On Apr 7, 1:08 pm, akineko wrote:
> Hello everyone,
>
> I'm trying to use named pipes to fuse a Python program and a C
> program.
> One side creates pipes using os.mkfifo() and both sides use the same
> named pipes (one side reads, another side writes). The read side uses
> select.select() to wait
Hello,
Anyone using Python for coding up genetic algorithms? If
so, would you share your favorite modules/libraries/tools?
Thanks,
Esmail
--
http://mail.python.org/mailman/listinfo/python-list
Gilles Ganault wrote:
> On Wed, 08 Apr 2009 12:11:55 +0200, Ulrich Eckhardt
> wrote:
>>find() returns the index where it is found or -1 if it is not found. Both
>> an
>>index>0 or a -1 evaluate to True when used as conditional expression.
>
> Thanks everyone. I shouldn't have assumed that "if test
QOTW: "Those who show promise can advance to our Winter Improve Python to
Expert program, for an additional fee, and, be given expert tutoring to help
you gain our exemplary A.R.S.E./W.I.P.E certification which is guaranteed to
attract certain types of employers by its name alone." - Paddy3118
On Wed, 08 Apr 2009 12:11:55 +0200, Ulrich Eckhardt
wrote:
>find() returns the index where it is found or -1 if it is not found. Both an
>index>0 or a -1 evaluate to True when used as conditional expression.
Thanks everyone. I shouldn't have assumed that "if test.find(item):"
was necessarily enou
> Here's a tricky case that doesn't show up in your example:
> In each case above, the directory names are distinct.
> how about:
>['/desk', '/desk/ethanallen', '/desk/ikea',
> '/desktop', /desktop/pc', '/desktop/mac']
>Should the answer be ['/desk'] or ['/desk', '/desktop'] ?
Hi Scott
good po
Remeber the return value of find function of a string is -1 when it
fails, which is True.
Try:
for item in isp:
if item in test:
print item
From: Gilles Ganault
Date: April 8, 2009 5:56:34 PM CST
To: python-list@python.org
Subject: Why does Python show the whole array?
> "tleeuwenb...@gmail.com" (tc) wrote:
>tc> What, exactly, needs to be in place for an object to be a valid
>tc> dictionary key?
It must have __hash__ and __cmp__ or __eq__ methods. Newstyle classes
inherit these from object.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142B
Gilles Ganault wrote:
Hello
I'd like to go through a list of e-mail addresses, and extract those
that belong to well-known ISP's. For some reason I can't figure out,
Python shows the whole list instead of just e-mails that match:
=== script
test = "t...@gmail.com"
isp = ["gmail.com", "yah
> Carl Banks (CB) wrote:
>CB> On Apr 6, 2:23 pm, "Diez B. Roggisch" wrote:
>>> > This is a classical synchronization problem with a classical solution:
>>> > You treat the readers as a group, and the writers individually. So you
>>> > have a write lock that each writer has to acquire and rel
Gilles Ganault writes:
> I'd like to go through a list of e-mail addresses, and extract those
> that belong to well-known ISP's. For some reason I can't figure out,
> Python shows the whole list instead of just e-mails that match:
>
> === script
> test = "t...@gmail.com"
> isp = ["gmail.com"
On Wed, 2009-04-08 at 12:01 +0200, Peter Otten wrote:
> Gilles Ganault wrote:
>
> > I'd like to go through a list of e-mail addresses, and extract those
> > that belong to well-known ISP's. For some reason I can't figure out,
> > Python shows the whole list instead of just e-mails that match:
> >
Gilles Ganault wrote:
> test = "t...@gmail.com"
> isp = ["gmail.com", "yahoo.com"]
> for item in isp:
> if test.find(item):
> print item
> === output
> gmail.com
> yahoo.com
> ===
>
> Any idea why I'm also getting "yahoo.com"?
find() returns the index where it is found or -1 if it is not
1 - 100 of 113 matches
Mail list logo