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


Groups > comp.lang.python > #93742

Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ?

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <albert.visser@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:text': 0.04; 'indicated': 0.07; "subject:' ": 0.07; 'subject:code': 0.07; 'client:': 0.09; 'nameerror:': 0.09; 'subject:Getting': 0.09; 'subject:Why': 0.09; 'typed': 0.09; 'python': 0.10; 'subject: \n ': 0.15; '"expected': 0.16; 'error"': 0.16; 'soup': 0.16; 'subject:Started': 0.16; 'wrote:': 0.16; 'subject:page': 0.18; '>>>': 0.20; '2015': 0.20; 'suggested': 0.20; '"",': 0.22; '12th': 0.22; 'code,': 0.23; 'defined': 0.23; 'bit': 0.23; 'second': 0.24; 'import': 0.24; '(most': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'least': 0.27; '+0200,': 0.27; 'preceding': 0.29; 'whitespace': 0.29; 'character': 0.29; 'code': 0.30; 'skip:s 30': 0.31; 'traceback': 0.33; 'file': 0.34; 'received:google.com': 0.35; 'nov': 0.35; 'something': 0.35; 'expected': 0.35; 'should': 0.36; '(and': 0.36; 'to:addr:python- list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'means': 0.39; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'more': 0.63; 'dear': 0.67; 'jul': 0.72; 'sunday': 0.72; '2013,': 0.91; 'albert': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:to:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=36igi8YTjJYmLt/1lwY65VogrfqERaYIImVngawrL6M=; b=DX4N+6EEXTxVpTITVIZo7/i/rtHgqpzjtngbXvgi0/eccyE3hn4Svm3FPAzLT0Zmhs TJski0/Bl6lEI4/iY47zPC0UQI80RQR2FLoODEcj6sXFGiMkAwtqDxVQ8yKx73xA7dEl 78TiaNaSKqjxQaIX6lg3JQYGW4mboeRYp8U9iCd+xNTTEkExaxc7mkZu9fT+SeLM31+R OKzmglfkrCRS3/yVtI6/65MUSCcIfXJfeCsslyjtJ6a97/F2V1WXlPUh/DfJcG33UfRA SLozEozcfb0jt+RadoySlno9cyLBGj8ylKNjIlfE3qUMWasmBz2eo0QRo2iGwTeR0ve7 jqdg==
X-Received by 10.180.79.162 with SMTP id k2mr16305939wix.46.1436726061324; Sun, 12 Jul 2015 11:34:21 -0700 (PDT)
Content-Type text/plain; charset=utf-8; format=flowed; delsp=yes
To python-list@python.org
Subject Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ?
References <cbcc6d3f-1fc7-4caf-b6d9-3a7ff9d8f1d5@googlegroups.com> <1e75fe53-743b-4432-8b4e-6897b3d54956@googlegroups.com>
Date Sun, 12 Jul 2015 20:34:18 +0200
MIME-Version 1.0
Content-Transfer-Encoding 7bit
From "Albert Visser" <albert.visser@gmail.com>
In-Reply-To <1e75fe53-743b-4432-8b4e-6897b3d54956@googlegroups.com>
User-Agent Opera Mail/12.16 (Linux)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.454.1436726068.3674.python-list@python.org> (permalink)
Lines 47
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1436726068 news.xs4all.nl 2935 [2001:888:2000:d::a6]:40068
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93742

Show key headers only | View raw


On Sun, 12 Jul 2015 19:33:17 +0200, Simon Evans  
<musicalhacksaw@yahoo.co.uk> wrote:

>
> Dear Peter Otten,
> I typed in (and did not copy and paste) the code as you suggested just  
> now (6.28 pm, Sunday 12th July 2015), this is the result I got:
> ----------------------------------------------------------------------------
> Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit  
> (Intel)] on win
> 32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from bs4 import BeautifulSoup
>>>> with open("C:\Beautiful Soup\ecologicalpyramid.html","r")as f:
> ... soup = BeautifulSoup(f,"lxml")
>   File "<stdin>", line 2
>     soup = BeautifulSoup(f,"lxml")
>        ^
> IndentationError: expected an indented block
>>>> soup = BeautifulSoup(f,"lxml")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> NameError: name 'f' is not defined
>>>>
> ----------------------------------------------------------------------------
> The first time I typed in the second line, I got the
> "Indentation error"
> the second time I typed in exactly the same code, I got the:
> "NameError:name 'f' is not defined"

"Expected an indented block" means that the indicated line should have  
started with at least one whitespace character more than the preceding  
line.

  >>> with open("C:\Beautiful Soup\ecologicalpyramid.html","r")as f:
  ... soup = BeautifulSoup(f,"lxml")

should have been something like

  >>> with open("C:\Beautiful Soup\ecologicalpyramid.html","r")as f:
  ...     soup = BeautifulSoup(f,"lxml")
-- 
Vriendelijke groeten / Kind regards,

Albert Visser

Using Opera's mail client: http://www.opera.com/mail/

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


Thread

Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Simon Evans <musicalhacksaw@yahoo.co.uk> - 2015-07-11 15:17 -0700
  Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-12 00:06 +0100
  Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Simon Evans <musicalhacksaw@yahoo.co.uk> - 2015-07-12 01:59 -0700
    Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Peter Otten <__peter__@web.de> - 2015-07-12 11:51 +0200
  Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Simon Evans <musicalhacksaw@yahoo.co.uk> - 2015-07-12 04:48 -0700
    Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Peter Otten <__peter__@web.de> - 2015-07-12 14:26 +0200
  Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Simon Evans <musicalhacksaw@yahoo.co.uk> - 2015-07-12 05:36 -0700
  Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Simon Evans <musicalhacksaw@yahoo.co.uk> - 2015-07-12 05:48 -0700
    Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Peter Otten <__peter__@web.de> - 2015-07-12 15:12 +0200
    Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Larry Hudson <orgnut@yahoo.com> - 2015-07-12 13:06 -0700
  Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Simon Evans <musicalhacksaw@yahoo.co.uk> - 2015-07-12 10:33 -0700
    Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? MRAB <python@mrabarnett.plus.com> - 2015-07-12 19:05 +0100
    Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-12 19:23 +0100
    Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? "Albert Visser" <albert.visser@gmail.com> - 2015-07-12 20:34 +0200
    Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Laura Creighton <lac@openend.se> - 2015-07-12 21:47 +0200
    Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-12 21:09 +0100
    Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Laura Creighton <lac@openend.se> - 2015-07-12 22:29 +0200
    Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-12 21:48 +0100
  Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Laurent Pointal <laurent.pointal@free.fr> - 2015-07-12 19:54 +0200
    Re: Why doesn't input code return 'plants' as in 'Getting Started with Beautiful Soup' text (on page 30) ? Chris Angelico <rosuav@gmail.com> - 2015-07-13 03:58 +1000

csiph-web