On 30/07/18 19:11, Zachary Ware wrote:
> On Mon, Jul 30, 2018 at 1:08 PM Alan Gauld via Tutor wrote:
>> There are lots of options including those suggested elsewhere.
>> Another involves using get() which makes your function
>> look like:
>>
>> def viceversa(d):
>> new_d = dict()
>> for k
On Mon, Jul 30, 2018 at 1:08 PM Alan Gauld via Tutor wrote:
> There are lots of options including those suggested elsewhere.
> Another involves using get() which makes your function
> look like:
>
> def viceversa(d):
> new_d = dict()
> for k in d:
> for e in d[k]:
>
On 30/07/18 13:40, Valerio Pachera wrote:
> users = {'user1':['office-a', 'office-b'],
> 'user2':['office-b'],
> 'user3':['office-a','office-c']}
>
> It's a list of users.
> For each user there's a list of room it can access to.
>
> I wish to get the same info but "sorted" by room.
Zachary Ware wrote:
> On Mon, Jul 30, 2018 at 12:20 PM Valerio Pachera wrote:
>> I was looking to substiture the cicle for e in new_d like this:
>> [ new_d[e].append(k) if e in new_d else new_d[e].append(k) for e in
>> [ d[k] ]
>> but it can't work because 'new_d[e] = []' is missing.
>
>
On Mon, Jul 30, 2018 at 12:20 PM Valerio Pachera wrote:
> I was looking to substiture the cicle for e in new_d like this:
> [ new_d[e].append(k) if e in new_d else new_d[e].append(k) for e in d[k] ]
> but it can't work because 'new_d[e] = []' is missing.
Have a look at `dict.setdefault` and
On Mon, May 2, 2016 at 5:28 PM Jason N. via Tutor wrote:
> Hello,
> Wanted to ask if its possible to have a dictionary that can be looked up
> by either values?
> For example,
> mydic = {"A: "Apple", "B": "Banana"}When user inputs "A" I want "Apple" to
> come. But if the user
On Mon, May 2, 2016 at 8:58 PM Jason N. via Tutor wrote:
> What is the best way to make dictionary requests case in-sensitive? For
> example, "Apple and "apple" should bring back the same dictionary
> response. Thank you.
>
Take a look at how the requests library solves the
Hello,
Using iteritems would be much easier approach
Something like this
mydic = {"A": "Apple", "B": "Banana"}
for key, value in mydic.iteritems(): if value == "Apple": print key
Thanks & BR, Bharath Shetty
On Tuesday, 3 May 2016 2:57 AM, Jason N. via Tutor
On 03May2016 00:56, Jason N. wrote:
Thank you all for your responses.
A quick follow up, what is the best way to make dictionary requests case
in-sensitive? For example, "Apple and "apple" should bring back the same
dictionary response. Thank you.
There are a few ways
If only I understand what you mean. You can just make all the values in the
dictionary lower, upper or capitalized. Then if you want take an input or
whatever you want to do with it just use .lower() or .upper() or .capitalized()
to convert it to what is in the dictionary. Maybe someone has a
Thank you all for your responses.
A quick follow up, what is the best way to make dictionary requests case
in-sensitive? For example, "Apple and "apple" should bring back the same
dictionary response. Thank you.
On Monday, May 2, 2016 6:57 PM, Bob Gailer wrote:
On May 2, 2016 5:27 PM, "Jason N. via Tutor" wrote:
>
> Hello,
> Wanted to ask if its possible to have a dictionary that can be looked up
by either values?
> For example,
> mydic = {"A: "Apple", "B": "Banana"}When user inputs "A" I want "Apple"
to come. But if the user enter
On 02/05/16 22:55, isaac tetteh wrote:
>
> For some reason i cant find reply all . But try this
> for key, value in mydic.items():
> If A==value:
>Print key
or as a function:
def findKey(dct, val):
for k,v in dct.items():
if v == val:
return k
mydic = {"A:
Sorry for the if statement the correct statement should be "if 'apple' ==value:"
Sent from my iPhone
> On May 2, 2016, at 4:58 PM, isaac tetteh wrote:
>
>
> For some reason i cant find reply all . But try this
> for key, value in mydic.items():
> If A==value:
>
For some reason i cant find reply all . But try this
for key, value in mydic.items():
If A==value:
Print key
Nb: use iteritems() if using python2
Sent from my iPhone
> On May 2, 2016, at 4:29 PM, Jason N. via Tutor wrote:
>
> Hello,
> Wanted to ask if its
jarod_v6--- via Tutor wrote:
> Dear All!
> I have this elements
>
> In [445]: pt = line.split("\t")[9]
>
> In [446]: pt
> Out[446]: 'gene_id "ENSG0223972"; gene_version "5"; transcript_id
> "ENST0456328"; transcript_version "2"; exon_number "1"; gene_name
> "DDX11L1"; gene_source
On 08/08/15 00:05, Ltc Hotspot wrote:
Hi Alan,
On line 15, I replaced: 'count[address] = count.get(address, 0) + 1'
with 'line = Counter(address)'.
line = Counter(address)
will create a new Counter object with the address in it with a count
value of 1.
Every line in the file will create a
On 8/6/2015 5:30 PM, Ltc Hotspot wrote:
I'm following the instructor's video exercise, available at
https://www.youtube.com/watch?v=3cwXN5_3K6Q.
As you're clearly interested in learning python, you may find working
the tutorial beneficial as it steps you through the fundamentals of
python
Alan,
I want to find the max val , keys and values are defined on line 10:
for kee, val in count.items():
Then, maxval determines the max value on line 11:
if val maxval:
right, view a copy of the revised code at
http://tinyurl.com/nvzdw8k
Question1: are these assumptions true, above?
Mark,
I'm following the instructor's video exercise, available at
https://www.youtube.com/watch?v=3cwXN5_3K6Q.
View attached screen shot file, image file shows a copy of the
counter: cou[wrd] =cou.get(wrd,0) +1
Please, explain the differences in counter methods?
Hal
On Thu, Aug 6, 2015 at
Question1: How type of argument should I use for dict, i.e.,user argument
or list argument.
Read captured traceback:
TypeError
Traceback (most recent call last)
C:\Users\vm\Desktop\apps\docs\Python\assignment_9_4_26.py in module()
1 fname = raw_input(Enter file name: )
2 handle =
On 07/08/15 01:15, Ltc Hotspot wrote:
Question1: How type of argument should I use for dict, i.e.,user argument
or list argument.
Read captured traceback:
TypeError
Traceback (most recent call last)
C:\Users\vm\Desktop\apps\docs\Python\assignment_9_4_26.py in module()
1 fname =
On 07/08/2015 01:30, Ltc Hotspot wrote:
Mark,
I'm following the instructor's video exercise, available at
https://www.youtube.com/watch?v=3cwXN5_3K6Q.
View attached screen shot file, image file shows a copy of the
counter: cou[wrd] =cou.get(wrd,0) +1
Please, explain the differences in
Hi Mark,
Why is Counter not defined on line #15: line =
Counter(address),i.e., NameError: name 'Counter' is not defined?
Share a chat session at http://tinyurl.com/oull2fw
View line entry at http://tinyurl.com/oggzn97
Hal
On Fri, Aug 7, 2015 at 12:14 AM, Mark Lawrence breamore...@yahoo.co.uk
On 07/08/15 19:18, Ltc Hotspot wrote:
I want to find the max val , keys and values are defined on line 10:
for kee, val in count.items():
Yes we know that, but you are not answering the questions we pose.
Instead you seem to post random changes to your code and ask new
questions which
Mark,
Visit the following URL link to view a captured copy of the latest code
revision, available at http://tinyurl.com/nvzdw8k
Regards,
Hal
On Thu, Aug 6, 2015 at 10:17 AM, Ltc Hotspot ltc.hots...@gmail.com wrote:
On Thu, Aug 6, 2015 at 8:28 AM, Mark Lawrence breamore...@yahoo.co.uk
Hi Alan,
I moved counter outside the loop and below dict, maxval = None
maxkee = None are both positioned outside the loop.
URL link to the revisions are available at http://tinyurl.com/nvzdw8k
Question: How do I define Counter
Revised code reads:
fname = raw_input(Enter file name: )
handle =
On 06/08/15 19:30, Ltc Hotspot wrote:
I moved counter outside the loop and below dict, maxval = None
maxkee = None are both positioned outside the loop.
You moved counter but it is still a dict() and you
don't use it anywhere.
URL link to the revisions are available at
On 06/08/15 03:27, Ltc Hotspot wrote:
The output as reported by the latest code revision: c...@iupui.edu
mailto:c...@iupui.edu 1← Mismatch
Looks like python continues to print the wrong data set:
Python will print what you ask it to. Don't blame the tool! :-)
for line in handle:
if
Mark,
Replace count[address]= count.get(address,0) +1 with c =
Counter(['address'])?
Regards,
Hal
On Wed, Aug 5, 2015 at 9:03 PM, Mark Lawrence breamore...@yahoo.co.uk
wrote:
On 05/08/2015 23:58, Ltc Hotspot wrote:
Hi Mark,
Address identifies the email address with the maximum number
On my breath and soul, I did:
Counter objects have a dictionary interface except that they return a zero
count for missing items instead of raising a KeyError
https://docs.python.org/3/library/exceptions.html#KeyError:
c = Counter(['eggs', 'ham'])
On Thu, Aug 6, 2015 at 11:59 AM, Mark
On 07/08/15 00:11, Ltc Hotspot wrote:
Questions(1):Why does print line, prints blank space; and, (2) print
address prints a single email address:
See my previous emails.
You are not storing your addresses so address only holds the last
address in the file.
line is at the end of the file so
On 06/08/2015 20:05, Ltc Hotspot wrote:
On my breath and soul, I did:
Counter objects have a dictionary interface except that they return a zero
count for missing items instead of raising a KeyError
https://docs.python.org/3/library/exceptions.html#KeyError:
That's nice to know. What do the
On Thu, Aug 6, 2015 at 3:00 PM, Alan Gauld alan.ga...@btinternet.com
wrote:
On 06/08/15 19:30, Ltc Hotspot wrote:
I moved counter outside the loop and below dict, maxval = None
maxkee = None are both positioned outside the loop.
You moved counter but it is still a dict() and you
don't use
On 06/08/15 18:17, Ltc Hotspot wrote:
View revised code here:
fname = raw_input(Enter file name: )
handle = open (fname, 'r')
c = Counter(['address'])
count = dict ()
maxval = None
maxkee = None
for kee, val in count.items():
maxval = val
maxkee = kee
for line in handle:
On Thu, Aug 6, 2015 at 8:28 AM, Mark Lawrence breamore...@yahoo.co.uk
wrote:
On 06/08/2015 05:22, Ltc Hotspot wrote:
Please don't top post here, it makes following long threads difficult.
Mark,
Replace count[address]= count.get(address,0) +1 with c =
Counter(['address'])?
Try it at
On 06/08/2015 18:17, Ltc Hotspot wrote:
On Thu, Aug 6, 2015 at 8:28 AM, Mark Lawrence breamore...@yahoo.co.uk
wrote:
On 06/08/2015 05:22, Ltc Hotspot wrote:
Please don't top post here, it makes following long threads difficult.
Mark,
Replace count[address]= count.get(address,0) +1 with c
On 06/08/15 18:17, Ltc Hotspot wrote:
Replace count[address]= count.get(address,0) +1 with c =
Counter(['address'])?
You didn't do what Mark suggested.
Did you read the documentation about Counter?
NameError
Traceback (most recent call last)
2 handle = open (fname, 'r')
3 c =
The revised output reads:
In [3]: %run assignment_9_4_9.py
Enter file name: mbox-short.txt
c...@iupui.edu 14
The desired output: c...@iupui.edu 5
Question: How do I trace the source of the count?
Revised data code reads:
fname = raw_input(Enter file name: )
handle = open (fname, 'r')
count =
Hi Alan
The output as reported by the latest code revision: c...@iupui.edu 1 ←
Mismatch
Looks like python continues to print the wrong data set:
In [11]: print val
1 In [12]: print kee r...@media.berkeley.edu In [13]: print address
c...@iupui.edu
In order to complete the assignment, using data
On 06/08/2015 05:22, Ltc Hotspot wrote:
Please don't top post here, it makes following long threads difficult.
Mark,
Replace count[address]= count.get(address,0) +1 with c =
Counter(['address'])?
Try it at the interactive prompt and see what happens.
Regards,
Hal
On Wed, Aug 5, 2015
On 05/08/2015 23:58, Ltc Hotspot wrote:
Hi Mark,
Address identifies the email address with the maximum number of sends:
c...@iupui.edu.
Secondly, we are missing a count on the number of messages sent by
c...@iupui.edu, i.e., 5.
Thirdly, maxval 'none' is not defined on line # 24
Questions:
On 06/08/15 02:05, Ltc Hotspot wrote:
The revised output reads:
In [3]: %run assignment_9_4_9.py
Enter file name: mbox-short.txt
c...@iupui.edu mailto:c...@iupui.edu 14
The desired output: c...@iupui.edu mailto:c...@iupui.edu 5
See my other post.
Count the number of letters in the address.
On 05/08/15 23:58, Ltc Hotspot wrote:
fname = raw_input(Enter file name: )
handle = open (fname, 'r')
for line in handle:
if line.startswith(From: ):
address = line.split()[1]
So far so good.
## The program creates a Python dictionary that maps
## the sender's mail address
On 05/08/15 15:15, Ltc Hotspot wrote:
Raw data code reads:
Being picky here but data and code are very different
things (in most languages at least) and what you have
below is definitely code not data.
Meanwhile there are lots of issues in this code...
fname = raw_input(Enter file name: )
On 05/08/2015 15:15, Ltc Hotspot wrote:
Hi everyone:
I want to write a python program that reads through the data file of
mbox-short.txt.Mbox-short.txt, i.e., download is available at
http://www.py4inf.com/code/mbox-short.txt.
Secondly, I want for python to figure out who sent the greatest
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Mark Lawrence
Sent: Wednesday, August 05, 2015 3:23 PM
To: tutor@python.org
Subject: Re: [Tutor] Dictionary Issue
On 05/08/2015 15:15, Ltc Hotspot wrote:
Hi everyone:
I want
On 05/08/15 23:36, Clayton Kirkwood wrote:
It looks like the problem is with count=dict()
Should be count=dict{}
I may be wrong - U'm still a neophyte.
Yes, you're wrong! :-)
the correct form is as shown
count = dict()
Its calling the type operation which looks like
any other function and
However, there is a traceback message:
In [40]: %run 9_4_4.py
File C:\Users\vm\Desktop\apps\docs\Python\_9_4_4.py, line 19
count = dict()
^
SyntaxError: invalid syntax
Syntax error reporting is approximate: you might need to look a few lines
earlier to get at the root
Hi Mark,
Address identifies the email address with the maximum number of sends:
c...@iupui.edu.
Secondly, we are missing a count on the number of messages sent by
c...@iupui.edu, i.e., 5.
Thirdly, maxval 'none' is not defined on line # 24
Questions: How do we define the value of none for the
On Thu, Jun 4, 2015 at 2:30 AM, Peter Otten __pete...@web.de wrote:
Chris Stinemetz wrote:
Although I am certain it is not very efficient I was able to
accomplish what I wanted with the following code I wrote:
import os
import pprint
import csv
from collections import defaultdict
Chris Stinemetz wrote:
Although I am certain it is not very efficient I was able to
accomplish what I wanted with the following code I wrote:
import os
import pprint
import csv
from collections import defaultdict
print_map = {'MOU':0, 'Call_Att':1, 'Device':2}
header =
On 03/06/15 17:39, Chris Stinemetz wrote:
I am trying to create a dictionary of lists as I read a file. I
envision it looking like: {key: [float_type],[string_type]}
Thats not a dictionary of lists. You maybe mean:
{key: [[float_type],[string_type]]}
Which is a dictionary of lists of lists?
Resetting execution engine
Running
C:\Users\cs062x\Desktop\python\projects\PanHandle\PanHandle\PanHandle.py
The Python REPL process has exited
That's slightly unusual. How are you running this?
I am running it with Microsoft Visual Studio Community 2013 using
Python Tools for Visual
Alex Kleider wrote:
On 2014-04-08 14:34, Peter Otten wrote:
That's a change in Python 3 where dict.keys() no longer creates a list,
but
instead creates a view on the underlying dict data thus saving time and
space. In the rare case where you actually need a list you can
explicitly
create
On 2014-04-08 23:55, Peter Otten wrote:
You can create and sort the list in a single step:
l = sorted(myDict)
Thank you again; this is a new idiom for me.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
Alex Kleider wrote:
I've got a fairly large script that uses a dictionary (called 'ipDic')
each
value of which is a dictionary which in turn also has values which are
not
simple types.
Instead of producing a simple list,
ips = ipDic.keys()
print(ips)
yields
On 2014-04-08 14:34, Peter Otten wrote:
That's a change in Python 3 where dict.keys() no longer creates a list,
but
instead creates a view on the underlying dict data thus saving time and
space. In the rare case where you actually need a list you can
explicitly
create one with
ips =
Nitish Kunder wrote:
I have a dictionary which is in this format
for ex:
{
'5x' : {
'50' : {
'update' : {
'update-from-esxi5.0-5.0_update01' : {
'call' : Update,
'name' : 'Update50u1',
'release' : '15/03/12'
},
'update-from-esxi5.0-5.0_update02' : {
'call' : Update,
'name' :
On 10/31/2013 2:16 AM, Nitish Kunder wrote:
I have a dictionary which is in this format
for ex:
{
'5x' : {
'50' : {
'update' : {
'update-from-esxi5.0-5.0_update01' : {
'call' : Update,
'name' : 'Update50u1',
'release' : '15/03/12'
},
'update-from-esxi5.0-5.0_update02' : {
'call' : Update,
Note: in* 'call' : Update* ,Update it is a function defined in my python
script. My dictionary is too large so i taught rather than using directly
in python program I save it in a text file and when needed i assign it to
dictionary object . How can i assign this text file to dictionary
On 20/03/13 14:54, Amit Saha wrote:
Hello Phil,
On Wed, Mar 20, 2013 at 12:54 PM, Phil phil_...@bigpond.com wrote:
Thank you for reading this.
I'm working my way through a series of exercises where the author only
provides a few solutions.
The reader is asked to modify the histogram example
On 20/03/13 15:09, Mitya Sirenef wrote:
cut
By the way, you can further simplify it by doing:
def histogram2(s):
return {c: d.get(c,0)+1 for c in s}
That will work in python 3, in python 2 you need:
return dict((c: d.get(c,0)+1) for c in s)
Thanks again Mitya, although I'm not
Phil wrote:
On 20/03/13 15:09, Mitya Sirenef wrote:
cut
By the way, you can further simplify it by doing:
def histogram2(s):
return {c: d.get(c,0)+1 for c in s}
That will work in python 3, in python 2 you need:
return dict((c: d.get(c,0)+1) for c in s)
Thanks again
On 03/20/2013 04:21 AM, Peter Otten wrote:
Phil wrote:
On 20/03/13 15:09, Mitya Sirenef wrote:
cut
By the way, you can further simplify it by doing:
def histogram2(s):
return {c: d.get(c,0)+1 for c in s}
That will work in python 3, in python 2 you need:
return dict((c:
On 03/19/2013 10:54 PM, Phil wrote:
Thank you for reading this.
I'm working my way through a series of exercises where the author
only provides a few solutions.
The reader is asked to modify the histogram example so that it uses
the get method thereby eliminating the if and else
Hello Phil,
On Wed, Mar 20, 2013 at 12:54 PM, Phil phil_...@bigpond.com wrote:
Thank you for reading this.
I'm working my way through a series of exercises where the author only
provides a few solutions.
The reader is asked to modify the histogram example so that it uses the get
method
On 03/19/2013 10:54 PM, Phil wrote:
Thank you for reading this.
I'm working my way through a series of exercises where the author
only provides a few solutions.
The reader is asked to modify the histogram example so that it uses
the get method thereby eliminating the if and else
On 03/20/2013 01:09 AM, Mitya Sirenef wrote:
By the way, you can further simplify it by doing:
def histogram2(s):
return {c: d.get(c,0)+1 for c in s}
That will work in python 3, in python 2 you need:
return dict((c: d.get(c,0)+1) for c in s)
Sorry, it should use a comma:
return
On 6/17/2012 2:26 PM, Selby Rowley-Cannon wrote:
[snip]
Do you have any programming (algorithm development) experience?
Do you want to translate words independent of context?
--
Bob Gailer
919-636-4239
Chapel Hill NC
___
Tutor maillist -
Does this language have grammar independent of english?
If no, just use .split() on the string and loop through that.
If yes, well, its much more complicated
On Jun 17, 2012 2:27 PM, Selby Rowley-Cannon selbyrowleycan...@ymail.com
wrote:
Version: 2.7
OS: Ubuntu 12.04 LTS
I am writing a
Alan Gauld wrote:
Since a class is effectively a disguised dictionary I'm not sure why you
want to do this? If you just want to access the method by name then why
not just call getattr(spam,'get_mean')?
Thanks for the feedback and, yes, this makes sense. My use case was when the
statistic
On 08/02/2012 17:41, Gregory, Matthew wrote:
Alan Gauld wrote:
Since a class is effectively a disguised dictionary I'm not sure why you
want to do this? If you just want to access the method by name then why
not just call getattr(spam,'get_mean')?
Thanks for the feedback and, yes, this makes
On Tue, Feb 7, 2012 at 2:32 PM, Gregory, Matthew
matt.greg...@oregonstate.edu wrote:
Hi list,
I'm trying to understand how to use a class-level dictionary to act as a
switch for class methods. In the contrived example below, I have the
statistic name as the key and the class method as the
On 07/02/12 19:32, Gregory, Matthew wrote:
class Statistics(object):
STAT = {
'MEAN': get_mean,
'SUM': get_sum,
}
...
if __name__ == '__main__':
spam = Statistics(4, 3)
print spam.get_stat('mean')
print spam.get_stat('sum')
Since a class is
Op 08-12-11 10:03, sunil tech schreef:
/Can i copy the content if a dictionary in to another variable, with
out any link between the dictionary the variable?
/
Have a look at the copy module [1], or use the builtin dict.copy() method.
Cheers,
Timo
[1]
On 08/12/11 09:03, sunil tech wrote:
/Can i copy the content if a dictionary in to another variable, with out
any link between the dictionary the variable?
if so, please teach.
Yes, but they will both refer to the same object.
But the two references will be entirely independant:
D =
On Tue, May 10, 2011 at 5:27 AM, Clara Mintz jamani.s...@hotmail.com wrote:
Sorry I am completely new at python and don't understand why this function
is returning an empty dictionary. I want it to take a list of files open
them then return the number of characters as the value and the file
Noah Hall enali...@gmail.com wrote
What you want is something that takes the length of each line,
and add it to the sum. A simple way would be to do
sum(len(line) for line in file)
And if you just want the total count for the file an even
simpler way is to use file.read()
count =
On 01/-10/-28163 02:59 PM, Clara Mintz wrote:
Sorry I am completely new at python and don't understand why this function is
returning an empty dictionary. I want it to take a list of files open them then
return the number of characters as the value and the file name as the key.
def
Supposing your dictionary like this: dict={1:'My name is X',2:'My name is x
y z',3: 'i am X'}
You can use len(list) :
dict={1:'My name is X',2:'My name is x y z',3: 'i am X'}
for values in dict.values():
... if len(values.split(' '))3:
...print values
My name is X
My name is x y z
louis leichtnam wrote:
HEllo everyone,
I have a dictionnary, and I would like to print only the values that have
more/equal than 3 spaces in them for example: My name is Xavier.
d = {1: Hello world, 2: My name is Xavier, 3: ham and eggs,
4: Eat more cheese please!, 5: spam spam spam
Garry Bettle wrote:
Howdy all,
Hope this message finds everyone well.
I have dictionary of keys and a string of values.
i.e.
8 Fixtures:
I assume each fixture is a key, e.g. Swin, HGrn, etc.
Swin1828 1844 1901 1916 1932 1948 2004 2019 2036 2052 2107 2122
HGrn1148 1204 1218 1232
On 12/22/2010 7:31 AM, Steven D'Aprano wrote:
Also note: len(dict.keys()) == len(dict.values()) == len(dict)
--
Bob Gailer
919-636-4239
Chapel Hill NC
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
On Wed, 22 Dec 2010 23:31:39 +1100, Steven D'Aprano wrote:
In this case, you need to sum the number of races for all the fixtures:
num_races = sum(len(racetimes) for racetimes in FixtureDict.values())
Many thanks Steven for your explanation and final golden nugget of code.
On Wed, 22 Dec 2010
Hi-
I apologize for the size of the attached file, but the question
would make little sense if I made substantial deletions.
The program gives the following error:
Traceback (most recent call last):
File /Javastuff/python/Glau_Is.py, line 131, in module
Adestin[state]()
Jack Uretsky j...@hep.anl.gov wrote
Please do not reply to an existing thread when starting a new topic.
This messes up threaded newsreaders and several archives.
Start a new topic with a newmessage.
I apologize for the size of the attached file, but the question
would make little sense
On 10/11/2010 9:19 AM Jack Uretsky said...
Hi-
I apologize for the size of the attached file, but the question would
make little sense if I made substantial deletions.
The program gives the following error:
Traceback (most recent call last):
File /Javastuff/python/Glau_Is.py, line 131, in module
On Tue, 12 Oct 2010 03:19:22 am Jack Uretsky wrote:
Hi-
I apologize for the size of the attached file, but the question
would make little sense if I made substantial deletions.
The program gives the following error:
Traceback (most recent call last):
File
Khalid Al-Ghamdi wrote:
Hi everyone!
I'm using python 3.1 and I want to to know why is it when I enter the
following in a dictionary comprehension:
dc={y:x for y in list(khalid) for x in range(6)}
I get the following:
{'a': 5, 'd': 5, 'i': 5, 'h': 5, 'k': 5, 'l': 5}
instead of the
Lie Ryan lie.1...@gmail.com dixit:
note that:
[(y, x) for y in list(khalid) for x in range(6)]
[('k', 0), ('k', 1), ('k', 2), ('k', 3), ('k', 4), ('k', 5), ('h', 0),
('h', 1), ('h', 2), ('h', 3), ('h', 4), ('h', 5), ('a', 0), ('a', 1),
('a', 2), ('a', 3), ('a', 4), ('a', 5), ('l', 0),
Hugo Arts hugo.yo...@gmail.com dixit:
bc = {y: x for x, y in enumerate(khalid)}
Note that your output is like so:
{'a': 2, 'd': 5, 'i': 4, 'h': 1, 'k': 0, 'l': 3}
The first character in your original string gets a zero, the second a
one, so on and so forth. I'm hoping that's what you
On 12/5/2009 7:32 AM, Khalid Al-Ghamdi wrote:
Hi everyone!
I'm using python 3.1 and I want to to know why is it when I enter the
following in a dictionary comprehension:
dc={y:x for y in list(khalid) for x in range(6)}
are you sure you want this?
{'a': 0, 'd': 1, 'i': 2, 'h': 3, 'k': 4,
On Fri, Dec 4, 2009 at 9:32 PM, Khalid Al-Ghamdi emailkg...@gmail.com wrote:
Hi everyone!
I'm using python 3.1 and I want to to know why is it when I enter the
following in a dictionary comprehension:
dc={y:x for y in list(khalid) for x in range(6)}
I get the following:
{'a': 5, 'd': 5, 'i':
On 12/4/2009 12:32 PM Khalid Al-Ghamdi said...
Hi everyone!
I'm using python 3.1 and I want to to know why is it when I enter the
following in a dictionary comprehension:
dc={y:x for y in list(khalid) for x in range(6)}
Try breaking this into pieces...
First see what [(x,y) for y in in
Khalid Al-Ghamdi wrote:
Hi everyone!
I'm using python 3.1 and I want to to know why is it when I enter the
following in a dictionary comprehension:
dc={y:x for y in list(khalid) for x in range(6)}
I get the following:
{'a': 5, 'd': 5, 'i': 5, 'h': 5, 'k': 5, 'l': 5}
instead of
Dinesh B Vadhia dineshbvad...@hotmail.com wrote
Say, you have a dictionary of integers, are the integers stored
in a compressed integer format or as integers ie. are integers
encoded before being stored in the dictionary and then
decoded when read?
I can't think of any reason to compress
Dinesh B Vadhia wrote:
Say, you have a dictionary of integers, are the integers stored in a
compressed integer format or as integers ie. are integers encoded before
being stored in the dictionary and then decoded when read?
Integer objects are not special cased in dictionaries. They are stored
performance but could
enhance it. Weird, I know! I'll check in with the comp.lang.python lot.
Dinesh
Message: 3
Date: Wed, 29 Apr 2009 17:35:53 +0100
From: Alan Gauld alan.ga...@btinternet.com
Subject: Re: [Tutor
On Tue, Dec 02, 2008 at 01:08:09PM -0800, Jeremiah Jester wrote:
Hello,
I'm trying to gather a list of files and md5 hash them to do a checksum.
I've created a function for each dictionary. However, when i print out
the dictionary I don't get all the items. Any ideas?
Yep. Don't use
1 - 100 of 176 matches
Mail list logo