Sincerely sorry for spamming everybody. Dint know about yahoo's quirks
regarding html attachments..
Hopefully this works.
Hi everybody
I have a simple newbie kind of questions. I have tried hard to solve it, but
couldn't figure it out.
The problem is,
I want to make a tuple of tuples or a list
quantrum75 [EMAIL PROTECTED] wrote in
Hi everybody
Hi,
I think the key to your question is here:
a=((1,),(2,),(3,),(4,),(5,))
I need the comma since it is going into an excel sheet.
I think you are confused between tuples and comma separated
strings - which is what you
Dinesh B Vadhia [EMAIL PROTECTED] wrote i
I'm using a Javascript autocomplete plugin for an online
web application/service. Each time a user inputs a character,
the character is sent to the backend Python program which
searches for the character in a list of 10,000 string items.
Eeek!
also if you need to go for 2 results I propose you use filters
interactive menus which will help you tailor the query to the users desires
thus limit the query results.
___
Tutor maillist - Tutor@python.org
i think you are using ajax ... which undoubdetly uses an sql database since
its based on queries run from whithin the application in the browser
whithout the need for refreshing the page ... i would suggest you try
serching internet for something like google autocomplete feature i
guess the
My guess, though I'm not sure, is that google uses hashes...
why? Because they're a *ahem* load faster than loops, and the reason
is they replace the repetitive nature of a loop by using some type of
formula. Exactly /how/ this is implemented, I'm not sure.
A simple example of the speed
Dinesh B Vadhia wrote:
Kent
I'm using a Javascript autocomplete plugin for an online web
application/service. Each time a user inputs a character, the character
is sent to the backend Python program which searches for the character
in a list of 10,000 string items. Once it finds the
Kent Johnson [EMAIL PROTECTED] wrote
application/service. Each time a user inputs a character, the
character
is sent to the backend Python program which searches for the
character
in a list of 10,000 string items. Once it finds the character,
the
backend will return that string and N
Alan Gauld wrote:
One possibility is that the javascript fetches the list back on the
first few characters and caches it on the browser
Here is an autocomplete widget I use that can do exactly that:
http://www.dyve.net/jquery/?autocomplete
Kent
___
.
Dinesh
- Original Message -
*From:* Kent Johnson mailto:[EMAIL PROTECTED]
*To:* Dinesh B Vadhia mailto:[EMAIL PROTECTED]
*Cc:* tutor@python.org mailto:tutor@python.org
*Sent:* Wednesday, April 09, 2008 1:48 PM
*Subject:* Re: [Tutor] List comprehensions
Dinesh B Vadhia wrote
Here is a for loop operating on a list of string items:
data = [string 1, string 2, string 3, string 4, string 5, string 6,
string 7, string 8, string 9, string 10, string 11]
result =
for item in data:
result = item + \n
print result
I want to replace the for loop with a List
On Wed, Apr 9, 2008 at 7:12 AM, Dinesh B Vadhia
[EMAIL PROTECTED] wrote:
I want to replace the for loop with a List Comrehension (or whatever) to
improve performance (as the data list will be 10,000]. At each stage of
the for loop I want to print the result ie.
List comprehensions are for
On Wed, Apr 9, 2008 at 7:44 PM, Jerry Hill [EMAIL PROTECTED] wrote:
On Wed, Apr 9, 2008 at 7:12 AM, Dinesh B Vadhia
[EMAIL PROTECTED] wrote:
I want to replace the for loop with a List Comrehension (or whatever) to
improve performance (as the data list will be 10,000]. At each stage
of
: [Tutor] List comprehensions
Dinesh B Vadhia wrote:
Here is a for loop operating on a list of string items:
data = [string 1, string 2, string 3, string 4, string 5,
string 6, string 7, string 8, string 9, string 10, string 11]
result =
for item in data:
result = item + \n
print
:* tutor@python.org
*Sent:* Wednesday, April 09, 2008 12:40 PM
*Subject:* Re: [Tutor] List comprehensions
Dinesh B Vadhia wrote:
Here is a for loop operating on a list of string items:
data = [string 1, string 2, string 3, string 4, string 5,
string 6, string 7, string 8, string 9, string 10
Dinesh B Vadhia wrote:
Here is a for loop operating on a list of string items:
data = [string 1, string 2, string 3, string 4, string 5,
string 6, string 7, string 8, string 9, string 10, string 11]
result =
for item in data:
result = item + \n
print result
I'm not sure what
Dinesh B Vadhia wrote:
Here is a for loop operating on a list of string items:
data = [string 1, string 2, string 3, string 4, string 5,
string 6, string 7, string 8, string 9, string 10, string 11]
result =
for item in data:
result = some operation on item
print result
On Wed, Apr 9, 2008 at 4:15 PM, Dinesh B Vadhia
[EMAIL PROTECTED] wrote:
Sorry, let's start again.
This version really isn't any more helpful than the first one. I know
you corrected the sample code, but you haven't addressed any of the
fundamental questions that Kent or I asked.
I want to
On Wed, Apr 9, 2008 at 4:48 PM, Kent Johnson [EMAIL PROTECTED] wrote:
You could use
[ sys.stdout.write(some operation on item) for item in data ]
but I consider this bad style and I seriously doubt you will see any
difference in performance.
This really isn't a good idea. It will take
how do I create an empy int array of 10?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Empty?
array = []
If you want to assign 10 None, that would be:
array = [None] * 10
Andreas
Am Freitag, den 21.03.2008, 17:03 -0700 schrieb elis aeris:
how do I create an empy int array of 10?
___
Tutor maillist - Tutor@python.org
arra = [0] * 10 ?
On Fri, Mar 21, 2008 at 5:29 PM, Andreas Kostyrka [EMAIL PROTECTED]
wrote:
Empty?
array = []
If you want to assign 10 None, that would be:
array = [None] * 10
Andreas
Am Freitag, den 21.03.2008, 17:03 -0700 schrieb elis aeris:
how do I create an empy int array of
elis aeris wrote:
arra = [0] * 10 ?
If you want a list of ten zeroes, yes.
A couple of suggestions:
Find a tutorial introduction to Python such as those on python.org, or
google for dive into python, and go through the examples in there.
Also, use the interactive Python interpreter to try out
I know this isn't the right forum to ask but I'll try as someone might know.
For my web application, I need a list box with a search capability. An example
is the Python documentation (hit the F1 key under Windows from IDLE) and
specifically the Index list ie. context-sensitive search through
On Wed, Feb 27, 2008 at 2:21 AM, Dinesh B Vadhia
[EMAIL PROTECTED] wrote:
For my web application, I need a list box with a search capability. An
example is the Python documentation (hit the F1 key under Windows from IDLE)
and specifically the Index list ie. context-sensitive search through a
the tutor list has been strangely silent for a few days. Anyone know
what has happened? why?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
bill.wu wrote:
the tutor list has been strangely silent for a few days. Anyone know
what has happened? why?
I got about 20 e-mails from the list yesterday.
Do you consider this slient?
or do you maybe have a problem receiving messages
At 06:41 PM 1/17/2008, bill.wu wrote:
the tutor list has been strangely silent for a few days. Anyone know
what has happened? why?
FYI I see 34 messages in my Eudora Tutor mailbox, dated 1/16 Pacific
Time (Eudora converts the datetimes to my time zone, PT).
Here's a screenshot of that mailbox
On Nov 27, 2007 5:40 PM, Kent Johnson [EMAIL PROTECTED] wrote:
This is a two-liner using itertools.groupby() and operator.itemgetter:
data = [['Bob', '07129', 'projectA', '4001',5],
['Bob', '07129', 'projectA', '5001',2],
['Bob', '07101', 'projectB', '4001',1],
['Bob', '07140', 'projectC',
Richard Querin wrote:
import itertools, operator
for k, g in itertools.groupby(sorted(data), key=operator.itemgetter(0,
1, 2, 3)):
print k, sum(item[4] for item in g)
I'm trying to understand what's going on in the for statement but I'm
having troubles. The
s=set()
[s.add(tuple(x)) for x in myEntries]
myEntries = [list(x) for x in list(s)]
This could be written more concisely as...
s = set(tuple(x) for x in myEntries)
myEntries = [list(x) for x in list(s)]
Generator expressions are really cool.
Not what the OP asked for exactly. He wanted to
Michael Langford wrote:
What you want is a set of entries.
Not really; he wants to aggregate entries.
# remove duplicate entries
#
# myEntries is a list of lists,
#such as [[1,2,3],[1,2,foo],[1,2,3]]
#
s=set()
[s.add(tuple(x)) for x in myEntries]
A set can be constructed directly
I'm trying to process a list and I'm stuck. Hopefully someone can help
me out here:
I've got a list that is formatted as follows:
[Name,job#,jobname,workcode,hours]
An example might be:
[Bob,07129,projectA,4001,5]
[Bob,07129,projectA,5001,2]
[Bob,07101,projectB,4001,1]
On 28/11/2007, Richard Querin [EMAIL PROTECTED] wrote:
I've got a list that is formatted as follows:
[Name,job#,jobname,workcode,hours]
[...]
Now I'd like to consolidate entries that are duplicates. Duplicates
meaning entries that share the same Name, job#, jobname and workcode.
So for the
Richard Querin wrote:
I'm trying to process a list and I'm stuck. Hopefully someone can help
me out here:
I've got a list that is formatted as follows:
[Name,job#,jobname,workcode,hours]
An example might be:
[Bob,07129,projectA,4001,5]
[Bob,07129,projectA,5001,2]
bob gailer wrote:
2 - Sort the list. Create a new list with an entry for the first name,
project, workcode. Step thru the list. Each time the name, project,
workcode is the same, accumulate hours. When any of those change, create
a list entry for the next name, project, workcode and again
What you want is a set of entries. Unfortunately, python lists are not
hashable which means you have to convert them to something hashable
before you can use the python set datatype.
What you'd like to do is add each to a set while converting them to a
tuple, then convert them back out of the
I decided you probably should also have a cleanup function since garbage
collection won't work now unless you explicitly clean the function. This
approach works, and also works if you call the function again after you've
called cleanup (it just runs the function 1 more time, then again, returns
Ricardo Aráoz wrote:
Kent Johnson wrote:
I am building a list like this:
tree = []
for top in tops:
l2 = level2(top)
if l2:
tree.append((top, l2))
I would really like to turn this into a list comprehension:
tree = [ (top, level2(top)) for
Eric Brunson wrote:
Ricardo Aráoz wrote:
Kent Johnson wrote:
I am building a list like this:
tree = []
for top in tops:
l2 = level2(top)
if l2:
tree.append((top, l2))
I would really like to turn this into a list comprehension:
tree = [
I am building a list like this:
tree = []
for top in tops:
l2 = level2(top)
if l2:
tree.append((top, l2))
I would really like to turn this into a list comprehension:
tree = [ (top, level2(top)) for top in tops if level2(top) ]
but the call to level2()
Decorate level2 with a decorator that caches:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/425445
--Michael
On 11/1/07, Kent Johnson [EMAIL PROTECTED] wrote:
I am building a list like this:
tree = []
for top in tops:
l2 = level2(top)
if l2:
Kent Johnson wrote:
I am building a list like this:
tree = []
for top in tops:
l2 = level2(top)
if l2:
tree.append((top, l2))
I would really like to turn this into a list comprehension:
tree = [ (top, level2(top)) for top in tops if
Kent Johnson [EMAIL PROTECTED] wrote
I would really like to turn this into a list comprehension:
tree = [ (top, level2(top)) for top in tops if level2(top) ]
but the call to level2() is expensive enough that I don't want to
repeat
it. Is there any way to do this or am I stuck with the
Hi
can someone help with this please?
i got to this point with help from the list.
from BeautifulSoup import BeautifulSoupdoc = ['htmlheadtitlePage
title/title/head', 'bodyp id=firstpara align=centerThis is
paragraph bone/b.', 'p id=secondpara align=blahThis is
paragraph
When sending a reply to a post, to the list, should we also address
the reply to the author of the post to which we are replying?
(There's gotta be an easier way to say that..) If we do so, then the
author gets a duplicate of our reply.
I've run some statistics (but no more bar graphs ;-) ).
Dick Moores wrote:
When sending a reply to a post, to the list, should we also address
the reply to the author of the post to which we are replying?
(There's gotta be an easier way to say that..) If we do so, then the
author gets a duplicate of our reply.
I've run some statistics (but no
Dick Moores wrote:
When sending a reply to a post, to the list, should we also address
the reply to the author of the post to which we are replying?
(There's gotta be an easier way to say that..) If we do so, then the
author gets a duplicate of our reply.
I've run some statistics (but no
Dick Moores wrote:
When sending a reply to a post, to the list, should we also address
the reply to the author of the post to which we are replying?
(There's gotta be an easier way to say that..) If we do so, then the
author gets a duplicate of our reply.
This is configurable for each
On Tue, Aug 14, 2007 at 11:06:05AM -0700, Dick Moores wrote:
Replying only to the list takes a bit of trouble. The default
behavior seems to be that the Reply button addresses the author
only and not the list; Reply to all addresses both the list, the
author, and any others included in the
At 11:56 AM 8/14/2007, Kent Johnson wrote:
Dick Moores wrote:
When sending a reply to a post, to the list, should we also address
the reply to the author of the post to which we are replying?
(There's gotta be an easier way to say that..) If we do so, then the
author gets a duplicate of
Date: Tue, 14 Aug 2007 12:33:16 -0700
From: Dick Moores [EMAIL PROTECTED]
Subject: Re: [Tutor] Question re Tutor List Etiquette
To: tutor@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=us-ascii; format=flowed
At 11:56 AM 8/14/2007, Kent Johnson wrote:
Dick
On Tue, Aug 14, 2007 at 08:11:33PM +0100, Tom Fitzhenry wrote:
On Tue, Aug 14, 2007 at 11:06:05AM -0700, Dick Moores wrote:
Replying only to the list takes a bit of trouble. The default
behavior seems to be that the Reply button addresses the author
only and not the list; Reply to all
I wanted to know How to access the list elements which is in Dictionary
dict = {'John':['ph=919873673','res=91928827737'] , 'William' :
['ph=91983763','res=91837474848'] }
I want the output to be
1. John res=91928827737
2. William ph=91983763
-
pearl jb wrote:
I wanted to know How to access the list elements which is in Dictionary
dict = {'John':['ph=919873673','res=91928827737'] , 'William' :
['ph=91983763','res=91837474848'] }
I want the output to be
1. John res=91928827737
2. William ph=91983763
You can use
I've got a list that contain a bunch of information, including the
FQDN of a host.
host_data=['foo.example.com', 'other unimportant data']
I need to seperate the hostname from the domain name.
This is how I'm doing it, and it work, but it seems *really* hacky.
Is there a better (or more
* Ben Sherman [EMAIL PROTECTED] [070411 22:02]:
I've got a list that contain a bunch of information, including the
FQDN of a host.
host_data=['foo.example.com', 'other unimportant data']
I need to seperate the hostname from the domain name.
This is how I'm doing it, and it work, but it
Smith, Jeff wrote:
I'm getting use to using list iteration and comprehension but still have
some questions.
1. I know to replace
for i in range(len(list1)):
do things with list1[i]
with
for li in list1:
do things with li
but what if there are two lists that you
Kent Johnson wrote:
Smith, Jeff wrote:
I'm getting use to using list iteration and comprehension but still have
some questions.
1. I know to replace
for i in range(len(list1)):
do things with list1[i]
with
for li in list1:
do things with li
but what if there
On Wed, 21 Feb 2007 21:21:26 +1300
John Fouhy [EMAIL PROTECTED] wrote:
Kirk Bailey wrote:
ok, here comes some code:
f1=open(pagename,'r')
page=f1.readlines()
f1.close()
at the end of which, the data is in page, which is a list. But
something strange is going on here. all
Kirk Bailey wrote:
ok, here comes some code:
f1=open(pagename,'r')
page=f1.readlines()
f1.close()
at the end of which, the data is in page, which is a list. But
something strange is going on here. all the data is in a single cell!
it's a one cell list! Say what?
It sounds like for
ok, getting back to python and wikiness, I have a problem, this software
of mine seems to exibit different behavior under the latest edition of
python (2.5) than under the version used when I first wrote it (2.3).
It loads the page file, but returns it as a list (which is correcft) of
one
Kirk Bailey wrote:
ok, getting back to python and wikiness, I have a problem, this software
of mine seems to exibit different behavior under the latest edition of
python (2.5) than under the version used when I first wrote it (2.3).
It loads the page file, but returns it as a list (which is
On 2/21/07, Kirk Bailey [EMAIL PROTECTED] wrote:
[...]
Discussion on or off list is saught. Constructive criticism will be
graciously received and thanked.
Without links, pointers, code or anything grippable I find it
difficult to comment or discuss anything, since i haven't got the
faintest
Kirk:
Please reply to this message, not the other one I sent,
and please reply on-list in the future, using the 'reply-all' button
rather than 'reply.'
Otherwise the message just goes to me instead of to everyone, which is
the default on this list.
This copy of your e-mail is forwarded to the
On Fri, Feb 16, 2007 at 11:28:21AM +, Tim Golden wrote:
Kent Johnson wrote:
Tim Golden wrote:
field and [EMAIL PROTECTED] in cc: My problem there is that I usually
don't want to send the originating individual a private copy
of an email he/she is going to receive from the list in any
Dave Kuhlman wrote:
On Fri, Feb 16, 2007 at 11:28:21AM +, Tim Golden wrote:
Kent Johnson wrote:
Tim Golden wrote:
field and [EMAIL PROTECTED] in cc: My problem there is that I usually
don't want to send the originating individual a private copy
of an email he/she is going to receive from
Luke Paireepinart [EMAIL PROTECTED] wrote
It's not the inconvenience but the fact that it's nonstandard, as
far as
every mailing list i've been on except this.
It is interesting to see this thread because its a hot button of mine
that many new mailing lists implement this non standard
Alan Gauld wrote:
But its obvious there are two views at work here.
(The one which sees an apostrophe in it's and the
one which doesn't? ;)
But, joking aside, I think you've summarised the situation
quite well, and I suspect that -- given the what must be
thousands of mailing lists and
Tim Golden wrote:
Alan Gauld wrote:
But its obvious there are two views at work here.
(The one which sees an apostrophe in it's and the
one which doesn't? ;)
But, joking aside, I think you've summarised the situation
quite well, and I suspect that -- given the what must be
thousands of
Tim Golden wrote:
field and [EMAIL PROTECTED] in cc: My problem there is that I usually
don't want to send the originating individual a private copy
of an email he/she is going to receive from the list in any
case, so I usually cut-and-paste around so that only the list
is in To: AFAIK, TB
Kent Johnson wrote:
Tim Golden wrote:
field and [EMAIL PROTECTED] in cc: My problem there is that I usually
don't want to send the originating individual a private copy
of an email he/she is going to receive from the list in any
case, so I usually cut-and-paste around so that only the list
On 2/16/07, Alan Gauld [EMAIL PROTECTED] wrote:
As to standard list behaviour, I don't know of any list thats been
around for more than say 10 years that uses Reply to send to All.
This seems to be a very recent thing. (And most of the lists I am
on have been around for much more than 10 years!
On 2/16/07, ALAN GAULD [EMAIL PROTECTED] wrote:
However, the standard behavior at the time was that
replies went back to the mailing list, not to the original sender.
But the mailing list was the original sender so it was all wonderfully
consistent. Reply goes to sender only, which happens
Tim Golden schreef:
I would take minor issue -- with you, and with the creators
of Thunderbird which is my current mail client of choice. It
looks to me as though you're suggesting that the reply-all
button is there to reply to a list, whereas it seems to me
to be there to reply to all the
Greetings:
I just thought I'd throw my own hat into the ring. I'm trying out my
new, asbestos-free, flame-retardant underwear. ;^)
-Original Message-
Date: Fri, 16 Feb 2007 08:14:29 -0500
From: Michael P. Reilly [EMAIL PROTECTED]
Subject: Re: [Tutor] Replying to the tutor-list
2007/2/14, Alan Gauld [EMAIL PROTECTED]:
Because hitting Reply and sending to a list would only be
consistent if the list was the originator of the message.
Some mailing lists do implement this bizarre and
non-standard email behaviour but thankfully the Python
community doesn't! This behaviour
On 2/15/07, Andre Engels [EMAIL PROTECTED] wrote:
It's getting to be the majority of mailing lists that do it the other way,
and I find it quite irritating that this list does not - I have had several
times that I sent a mail, and after sending it, sometimes long after sending
it, I realize I
On 2/14/07, Mike Hansen [EMAIL PROTECTED] wrote:
The following tutor faq has an explanation:
http://www.python.org/infogami-faq/tutor/tutor-why-do-my-replies-go-to-t
he-person-who-sent-the-message-and-not-to-the-list/
I think the argument in that explanation sucks.
A asks something, B
On 2/14/07, Mike Hansen [EMAIL PROTECTED] wrote:
The following tutor faq has an explanation:
http://www.python.org/infogami-faq/tutor/tutor-why-do-my-replies-go-to-t
he-person-who-sent-the-message-and-not-to-the-list/
It seems like this is designed for the 5% case when it makes the
Richard Querin [EMAIL PROTECTED] wrote
The following tutor faq has an explanation:
http://www.python.org/infogami-faq/tutor/tutor-why-do-my-replies-go-to-t
he-person-who-sent-the-message-and-not-to-the-list/
It seems like this is designed for the 5% case when it makes the
other 95%
On 2/15/07, Alan Gauld [EMAIL PROTECTED] wrote:
I dunno about you but 95% of my email is private, only
about 5% comes from mailing lists.
Yeah, me too, but I guess it seems easier to just hit 'reply' 100% of the
time and have it go to the right recipient. My point really was that 95% of
2007/2/15, ALAN GAULD [EMAIL PROTECTED]:
realize I sent it to the sender instead of the list,
so I send a second message after it.
So do you find it odd when dealing with normal email
and you hit reply and it only goes to the sender?
No, because it is sent by the sender to me, not to
The major reason for not setting Reply-To: thelist is that it makes it
*SLIGHTLY* more difficult to post something to the list and replys should
go to the sender. IHMO, one should have to go to a little bit of effort
before posting a message that may go to thousands of recipients.
Using the
Bill Campbell wrote:
The major reason for not setting Reply-To: thelist is that it makes it
*SLIGHTLY* more difficult to post something to the list and replys should
go to the sender. IHMO, one should have to go to a little bit of effort
before posting a message that may go to thousands of
On Thu, Feb 15, 2007, Luke Paireepinart wrote:
Bill Campbell wrote:
The major reason for not setting Reply-To: thelist is that it makes it
*SLIGHTLY* more difficult to post something to the list and replys should
go to the sender. IHMO, one should have to go to a little bit of effort
before
On Thu, 15 Feb 2007, Bill Campbell wrote:
Having the Reply-To: to the original poster minimizes the probability of
somebody sending mail to a list that was intended for the original poster
(which may be private).
Well, no. It minimizes the probability of someone sending mail to a list.
All texts that I reply to this list are automatically sent to the
author, or - by selecting Reply all in my mail client - the
tutorlist gets a CC.
Why is there no reply-to-tag in all the posts, making the list
recipient at all times?
--
- Rikard.
___
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rikard Bosnjakovic
Sent: Wednesday, February 14, 2007 9:21 AM
To: tutor@python.org
Subject: [Tutor] Replying to the tutor-list
All texts that I reply to this list are automatically sent
On Wed, Feb 14, 2007 at 05:20:44PM +0100, Rikard Bosnjakovic wrote:
Why is there no reply-to-tag in all the posts, making the list
recipient at all times?
Believe it or not -- The email reader that I use (mutt on a FreeBSD
machine that I telnet/ssh into) has a reply-to-list operation.
That's
' and 'Reply all' options.
when I send a message using 'Reply it goes only to the Tutor List. Using the
'Reply all choice it goes to the prior poster with a copy to the list.
John Montgomery
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman
Rikard Bosnjakovic [EMAIL PROTECTED] wrote
All texts that I reply to this list are automatically sent to the
author, or - by selecting Reply all in my mail client - the
tutorlist gets a CC.
Yep, that makes sense. It's how mail tools work in a sane world.
You Reply and it goes to the sender.
prefer that, but it's a matter of taste, and this lists tastes
don't run that way.
I use procmail to add a Reply-To: header, and then dump the email into my
separate Python in-box:
# Python tutor list
:0:
* [EMAIL PROTECTED]
{
:0hf
| $FORMAIL -A Reply-To: tutor@python.org
Dick Moores wrote:
At 09:53 PM 12/6/2006, Luke Paireepinart wrote:
# Remove duplicates from a list:
L = [1,2,2,3,3,3]
[x for x in L if x not in locals()['_[1]'].__self__]
[1,2,3]
Why not
L = [1,2,2,3,3,3]
list(set(L))
[1, 2, 3]
Because the other methods (via set or dict keys) don't
Luke Paireepinart wrote:
How about this :D
# Remove duplicates from a list:
L = [1,2,2,3,3,3]
[x for x in L if x not in locals()['_[1]'].__self__]
[1,2,3]
[accessed at
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/204297 ]
The problems with this are, it is not portable, even
I'm new to programming, and trying to learn the Python language.
The following code does what I want it to do, but I have not idea how it
works.
def scanList(names,temp):
for i in names:
temp[i] = 0
print temp
Names = []
temp = {}
I have a list of names (Names[]) and want to
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Morpheus
Sent: Wednesday, December 06, 2006 9:00 AM
To: tutor@python.org
Subject: [Tutor] List to dictionary question
I'm new to programming, and trying to learn the Python language
I'm new to programming, and trying to learn the Python language.
The following code does what I want it to do, but I have not idea how it
works.
def scanList(names,temp):
for i in names:
temp[i] = 0
print temp
Names = []
temp = {}
I have a list of names (Names[]) and want to
At 09:53 PM 12/6/2006, Luke Paireepinart wrote:
I have a list of names (Names[]) and want to remove duplicate names in
the list. [snip]
The way I usually do this is something like:
outDict = dict(map(lambda x: (x, 1), inList))
names = outDict.keys()
names.sort()
How about
Dear Kent and Bob,
thank you for your solutions. It helped, however,
based on your suggestions, I intended to solve a
chromosome walking problem. I posted my question on
subject name:
'Limitation of range() function in Walking problem'.
Thanks again.
Sri
--- Kent Johnson [EMAIL PROTECTED]
501 - 600 of 657 matches
Mail list logo