rds,
Hal
On Tue, Aug 11, 2015 at 8:32 PM, Steven D'Aprano wrote:
> On Tue, Aug 11, 2015 at 07:38:21PM -0700, Ltc Hotspot wrote:
>> Steven,
>>
>> Visit the URL links below to view the latest revised code:
>
> I don't think so. I don't have access to the web
/ozzmffy
Thanks,
Hal
On Tue, Aug 11, 2015 at 7:01 PM, Steven D'Aprano
wrote:
> On Tue, Aug 11, 2015 at 04:24:39PM -0700, Ltc Hotspot wrote:
> > Hi Everyone,
> >
> > Why is there an AttributeError, line 12, below : 'tuple' object has no
> > attribute 'so
Hi Everyone,
Why is there an AttributeError, line 12, below : 'tuple' object has no
attribute 'sort'?
count = dict()
fname = raw_input("Enter file name: ")#
handle = open (fname, 'r')#
for line in handle:
if line.startswith("From "):
address = line.split()[5]
line = line.rstri
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
>> counte
ove?
Question2: dict maps strings into keys and values?
Hal
On Thu, Aug 6, 2015 at 11:35 PM, Alan Gauld
wrote:
> 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 ca
6, 2015 at 4:53 PM, Mark Lawrence
wrote:
> 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
>> <
the revised code?
Revised code is available at
https://gist.github.com/ltc-hotspot/00fa77ca9b40c0a77170
Regards,
Hal
On Thu, Aug 6, 2015 at 4:20 PM, Alan Gauld
wrote:
> On 07/08/15 00:11, Ltc Hotspot wrote:
>
>> Questions(1):Why does print line, prints blank space; and, (2) print
>> addr
On Thu, Aug 6, 2015 at 3:00 PM, Alan Gauld
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
am'])
On Thu, Aug 6, 2015 at 11:59 AM, Mark Lawrence
wrote:
> On 06/08/2015 18:17, Ltc Hotspot wrote:
>
>> On Thu, Aug 6, 2015 at 8:28 AM, Mark Lawrence
>> wrote:
>>
>> On 06/08/2015 05:22, Ltc Hotspot wrote:
>>>
>>> Please don't top post he
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 wrote:
>
>
> On Thu, Aug 6, 2015 at 8:28 AM, Mark Lawrence
> wrote:
>
>> On 06/08/20
x27; is not defined
Regards,
Hal
On Thu, Aug 6, 2015 at 2:47 AM, Alan Gauld
wrote:
> 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
On Thu, Aug 6, 2015 at 8:28 AM, Mark Lawrence
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 =
>> Coun
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
wrote:
> On 05/08/2015 23:58, Ltc Hotspot wrote:
>
>> Hi Mark,
>>
>> Address identifies the email address with
maxkee = None
for kee, val in count.items():
maxval = val
maxkee = kee
print address, val
Hal
On Wed, Aug 5, 2015 at 6:21 PM, Alan Gauld
wrote:
> On 05/08/15 23:58, Ltc Hotspot wrote:
>
> fname = raw_input("Enter file name: ")
>> handle = open (fname,
xkee = kee
print address, val
On Wed, Aug 5, 2015 at 4:11 PM, Alan Gauld
wrote:
> 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
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 k
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 number of
mail messages.
The output should r
edu'] ← Mismatch
There were 54 lines in the file with From as the first word
Desired output:
stephen.marqu...@uct.ac.za
lo...@media.berkeley.edu
zq...@umich.edu
rjl...@iupui.edu
zq...@umich.edu
rjl...@iupui.edu
c...@iupui.edu
c...@iupui.edu
gsil...@umich.edu
gsil...@umich.edu
zq...@umich.ed
addresses.add(line4)
count = count + 1
print addresses
print "There were", count, "lines in the file with From as the first word"
Regards,
Hal
On Sat, Aug 1, 2015 at 5:45 PM, Emile van Sebille wrote:
> On 8/1/2015 4:07 PM, Ltc Hotspot wrote:
>
>&
addresses.add(line4)
count = count + 1
print addresses
print "There were", count, "lines in the file with From as the first word"
Regards,
Hal
On Sat, Aug 1, 2015 at 5:44 PM, Alan Gauld
wrote:
> On 02/08/15 00:07, Ltc Hotspot wrote:
>
>> Question1:
..@uct.ac.za
david.horw...@uct.ac.za
david.horw...@uct.ac.za
stephen.marqu...@uct.ac.za
lo...@media.berkeley.edu
lo...@media.berkeley.edu
r...@media.berkeley.edu
c...@iupui.edu
c...@iupui.edu
c...@iupui.edu
There were 27 lines in the file with From as the first word
Regards,
Hal
On Sat, Aug 1, 2
addresses = set()
for addr in [ fromline.split()[0]
for fromline in mbox.split('From ')
if fromline ]:
count = count + 1
print addr
print "There were", count, "lines in the file with From as the first word"
Regards,
Hal
On Sat, Aug 1, 2015 at 2
tents of the file mbox-short.txt? (or the first
> 5-10 address sets if this is only representative) I think if we have a
> better understanding of the structure of the content you're parsing it'll
> help us identify what the program will need to be prepared to handle.
>
> Emile
gt;
> Emile
>
>
>
> On 7/31/2015 5:26 PM, Ltc Hotspot wrote:
>
>> Hi Mark,
>>
>> Desired output on execution of the script:
>>
>> stephen.marqu...@uct.ac.za
>> lo...@media.berkeley.edu
>> zq...@umich.edu
>> rjl...@iupui.edu
>> z
Hi Alan,
There is an indent message in the revised code.
Question: Where should I indent the code line for the loop?
View the revised codes with loop indents, below:
--->Revised Code v.2 wo/indent from lines 8-12:
fname = raw_input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-short.t
Mark:
Is this any better, message sent from GMail?
Regards,
Hal
On Fri, Jul 31, 2015 at 5:02 PM, Mark Lawrence
wrote:
> On 31/07/2015 19:57, ltc.hots...@gmail.com wrote:
>
> I believe that this is the third time that you've been asked to do
> something about the amount of whitespace that you're
Hi Mark,
Desired output on execution of the script:
stephen.marqu...@uct.ac.za
lo...@media.berkeley.edu
zq...@umich.edu
rjl...@iupui.edu
zq...@umich.edu
rjl...@iupui.edu
[...]
Regards,
Hal
On Fri, Jul 31, 2015 at 5:21 PM, Ltc Hotspot wrote:
> Mark:
> Is this any better, message sen
27 matches
Mail list logo