Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95301
| Subject | Re: AttributeError |
|---|---|
| References | (4 earlier) <103ea014-9bdb-4c37-acd1-cdc64f5f721e@googlegroups.com> <mqfq0t$8np$2@dont-email.me> <3f132c37-bdb5-4313-9285-69e094392ccf@googlegroups.com> <55CB7823.8010402@mrabarnett.plus.com> <CALa1VB52wjJesc8Skp=Uiu9fY-NMvfd8cPVEpnkxdX-22+xO6w@mail.gmail.com> |
| From | MRAB <python@mrabarnett.plus.com> |
| Date | 2015-08-12 18:24 +0100 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.128.1439400287.3627.python-list@python.org> (permalink) |
On 2015-08-12 17:57, Ltc Hotspot wrote:
> MRAB,
>
> I ran the code, and the output:
>
>
> Raw data code:
> handle = """From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008
> >From louis@media.berkeley.edu Fri Jan 4 18:10:48 2008
> """.split("\n")
> # Snippet file data: mbox-short.txt
>
> count = dict()
> #fname = raw_input("Enter file name: ")# Add Snippet file
> #handle = open (fname, 'r')# Add Snippet file
> for line in handle:
> if line.startswith("From "):
> time = line.split() # Sort time
>
> hours = list.split(":")[5] # Sort hours
> line = line.rstrip()
>
> count[hours] = count.get(hours, 0) + 1 # counter
>
> lst = [(val,key) for key,val in count.items()]
>
> print key, val
>
> -------------------------------------------------------------------------------------
> Syntax message:
> In [45]: %run assignment_10_2_v_06
>
> AttributeError
> Traceback (most recent call last)
> C:\Users\vm\Desktop\apps\docs\Python\week_10\assignment_10_2_v_06.py in <module>
> ()
> 11 time = line.split() # Sort time
> 12
> ---> 13 hours = list.split(":")[5] # Sort hours
> 14 line = line.rstrip()
> 15
>
> AttributeError: type object 'list' has no attribute 'split'
>
> In [46]:
Read the indicated line _carefully_.
What is it _actually_ trying to split?
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
AttributeError Ltc Hotspot <ltc.hotspot@gmail.com> - 2015-08-11 17:01 -0700
Re: AttributeError leo kirotawa <kirotawa@gmail.com> - 2015-08-11 21:16 -0300
Re: AttributeError MRAB <python@mrabarnett.plus.com> - 2015-08-12 01:26 +0100
Re: AttributeError Chris Angelico <rosuav@gmail.com> - 2015-08-12 10:49 +1000
Re: AttributeError MRAB <python@mrabarnett.plus.com> - 2015-08-12 01:58 +0100
Re: AttributeError Ltc Hotspot <ltc.hotspot@gmail.com> - 2015-08-11 22:03 -0700
Re: AttributeError MRAB <python@mrabarnett.plus.com> - 2015-08-12 16:12 +0100
Re: AttributeError Denis McMahon <denismfmcmahon@gmail.com> - 2015-08-12 15:50 +0000
Re: AttributeError Ltc Hotspot <ltc.hotspot@gmail.com> - 2015-08-12 09:29 -0700
Re: AttributeError MRAB <python@mrabarnett.plus.com> - 2015-08-12 17:45 +0100
Re: AttributeError Ltc Hotspot <ltc.hotspot@gmail.com> - 2015-08-12 09:57 -0700
Re: AttributeError MRAB <python@mrabarnett.plus.com> - 2015-08-12 18:24 +0100
RE: AttributeError "Clayton Kirkwood" <crk@godblessthe.us> - 2015-08-12 10:31 -0700
Re: AttributeError Emile van Sebille <emile@fenx.com> - 2015-08-12 10:37 -0700
Re: AttributeError Ltc Hotspot <ltc.hotspot@gmail.com> - 2015-08-12 11:35 -0700
Re: AttributeError MRAB <python@mrabarnett.plus.com> - 2015-08-12 19:59 +0100
Re: AttributeError Ltc Hotspot <ltc.hotspot@gmail.com> - 2015-08-12 12:05 -0700
Re: AttributeError Denis McMahon <denismfmcmahon@gmail.com> - 2015-08-12 20:38 +0000
RE: AttributeError "Clayton Kirkwood" <crk@godblessthe.us> - 2015-08-12 14:15 -0700
Re: AttributeError Emile van Sebille <emile@fenx.com> - 2015-08-12 14:32 -0700
Re: AttributeError Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-12 22:45 +0100
Re: AttributeError Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-12 22:51 +0100
Re: AttributeError Ltc Hotspot <ltc.hotspot@gmail.com> - 2015-08-12 14:04 -0700
Re: AttributeError Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-13 10:37 +0100
Re: AttributeError Ben Finney <ben+python@benfinney.id.au> - 2015-08-13 21:08 +1000
Re: AttributeError MRAB <python@mrabarnett.plus.com> - 2015-08-12 21:04 +0100
Re: AttributeError Denis McMahon <denismfmcmahon@gmail.com> - 2015-08-12 21:16 +0000
Re: AttributeError MRAB <python@mrabarnett.plus.com> - 2015-08-12 23:35 +0100
Re: AttributeError Ltc Hotspot <ltc.hotspot@gmail.com> - 2015-08-12 16:05 -0700
Re: AttributeError Emile van Sebille <emile@fenx.com> - 2015-08-12 16:15 -0700
Re: AttributeError MRAB <python@mrabarnett.plus.com> - 2015-08-13 00:16 +0100
Re: AttributeError Ltc Hotspot <ltc.hotspot@gmail.com> - 2015-08-12 16:46 -0700
Re: AttributeError Denis McMahon <denismfmcmahon@gmail.com> - 2015-08-13 09:15 +0000
Re: AttributeError Ltc Hotspot <ltc.hotspot@gmail.com> - 2015-08-13 02:41 -0700
Re: AttributeError Denis McMahon <denismfmcmahon@gmail.com> - 2015-08-13 11:06 +0000
Re: AttributeError MRAB <python@mrabarnett.plus.com> - 2015-08-13 00:56 +0100
Re: AttributeError Denis McMahon <denismfmcmahon@gmail.com> - 2015-08-12 20:28 +0000
Re: AttributeError Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-12 21:58 +0100
Re: AttributeError Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-12 03:46 +0100
Re: AttributeError Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-12 04:32 +0100
Re: AttributeError Chris Angelico <rosuav@gmail.com> - 2015-08-12 13:49 +1000
Re: AttributeError Denis McMahon <denismfmcmahon@gmail.com> - 2015-08-12 11:36 +0000
Re: AttributeError MRAB <python@mrabarnett.plus.com> - 2015-08-12 16:09 +0100
Re: AttributeError Gene Heskett <gheskett@wdtv.com> - 2015-08-12 17:25 -0400
Re: AttributeError Ltc Hotspot <ltc.hotspot@gmail.com> - 2015-08-12 15:02 -0700
Re: AttributeError Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-12 23:16 +0100
csiph-web