Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28780

Re: AttributeError: 'list' object has no attribute 'lower'

From Roy Smith <roy@panix.com>
Newsgroups comp.lang.python
Subject Re: AttributeError: 'list' object has no attribute 'lower'
Date 2012-09-09 10:32 -0400
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <roy-87C426.10323309092012@news.panix.com> (permalink)
References <df7ab5f7-c273-4a62-b79a-f364f9c2d3b0@googlegroups.com> <roy-838395.13453908092012@news.panix.com> <dea2fdd1-ad19-4254-b3bf-4104ce0cb241@googlegroups.com>

Show all headers | View raw


In article <dea2fdd1-ad19-4254-b3bf-4104ce0cb241@googlegroups.com>,
 Token Type <typetoken@gmail.com> wrote:

> > structures are simple, just plain print will work, but for more 
> > 
> > complicated structures, pprint.pprint() is a life saver.
> > 
> 
> I did try . However, 
> 
> >>> pprint.pprint(lemma_list)
> 
> Traceback (most recent call last):
>   File "<pyshell#74>", line 1, in <module>
>     pprint.pprint(lemma_list)
> NameError: name 'pprint' is not defined
> >>> pprint.pprint(synset_list)
> 
> Traceback (most recent call last):
>   File "<pyshell#75>", line 1, in <module>
>     pprint.pprint(synset_list)
> NameError: name 'pprint' is not defined
> >>> 

OK, I can see how this can be confusing.  In "pprint.pprint()", the two 
"pprint"s mean different things.  The first one is the name of a module.  
The second one is the name of a function in that module.  In general, I 
dislike this style of naming since it just leads to this kind of 
confusion.

In any case, you need to do one of two things.

Style 1:

import pprint
pprint.pprint(foo)

Style 2:

from pprint import pprint
pprint(foo)

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-08 10:13 -0700
  wordnet NLTK Re: AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-08 10:32 -0700
  Re: AttributeError: 'list' object has no attribute 'lower' Roy Smith <roy@panix.com> - 2012-09-08 13:45 -0400
    Re: AttributeError: 'list' object has no attribute 'lower' Cameron Simpson <cs@zip.com.au> - 2012-09-09 09:26 +1000
    Re: AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-09 06:50 -0700
      Re: AttributeError: 'list' object has no attribute 'lower' Roy Smith <roy@panix.com> - 2012-09-09 10:29 -0400
    Re: AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-09 07:00 -0700
      Re: AttributeError: 'list' object has no attribute 'lower' Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-09-10 11:52 +0200
        Re: AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-14 08:01 -0700
          Re: AttributeError: 'list' object has no attribute 'lower' Chris Angelico <rosuav@gmail.com> - 2012-09-15 01:19 +1000
        Re: AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-14 08:01 -0700
          Re: AttributeError: 'list' object has no attribute 'lower' Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-14 15:18 +0000
    Re: AttributeError: 'list' object has no attribute 'lower' Token Type <typetoken@gmail.com> - 2012-09-09 07:19 -0700
      Re: AttributeError: 'list' object has no attribute 'lower' Roy Smith <roy@panix.com> - 2012-09-09 10:32 -0400

csiph-web