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


Groups > comp.lang.python > #19009

Re: why i can get nothing?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jsf80238@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'oct': 0.02; 'importerror:': 0.07; 'python': 0.08; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; '"print"': 0.16; '2.7.2': 0.16; '[gcc': 0.16; 'linux2': 0.16; 'read()': 0.16; '>>>': 0.18; 'this?': 0.19; '(most': 0.21; 'header:In-Reply-To:1': 0.22; 'traceback': 0.24; 'sender:addr:gmail.com': 0.25; 'code': 0.25; 'guess': 0.25; 'module': 0.26; 'import': 0.27; 'message- id:@mail.gmail.com': 0.28; 'subject:?': 0.30; '\xa0\xa0\xa0': 0.30; 'version': 0.31; 'named': 0.33; 'to:addr:python-list': 0.33; 'last):': 0.34; 'received:209.85.160.46': 0.35; 'received:mail- pw0-f46.google.com': 0.35; 'received:209.85.160': 0.35; 'file': 0.35; 'to:name:python-list': 0.36; 'received:google.com': 0.37; 'subject:can': 0.37; 'received:209.85': 0.38; 'why': 0.39; 'received:209': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; 'type': 0.60; 'more': 0.61; 'url:v': 0.61; 'here': 0.64; 'subject:nothing': 0.84; 'naked': 0.91; 'url:open': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=7H8Wnb+AbpnhYrZigd6BMRQESRrPDCBdOv+1VIG5qE8=; b=wT6EGBSEuxFsKOls49wrs6DadLZGQ/v94EJCtxaB2DYBtEDXO/aYpgQZiAVZ89u5Up g+neXS5mbGNGijfvJbGevHr5tWOXmZzYEeBtISMN430UtCw0ZUjAly0goN0rnjIzgiBk +cjUTM8deb8VS/MJCZcx1D2bSRXzRPmUEJJO4=
MIME-Version 1.0
Sender jsf80238@gmail.com
In-Reply-To <CA+YdQ_76P-UJmEiD7dySoGXxwjFx_Tm-uww8KYJ5Dq0-zDSM1Q@mail.gmail.com>
References <CA+YdQ_76P-UJmEiD7dySoGXxwjFx_Tm-uww8KYJ5Dq0-zDSM1Q@mail.gmail.com>
Date Sun, 15 Jan 2012 15:40:56 +0000
X-Google-Sender-Auth 9o7YzpQluihnv9HO8-InCa5iG0E
Subject Re: why i can get nothing?
From Jason Friedman <jason@powerpull.net>
To python-list <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4773.1326642060.27778.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1326642060 news.xs4all.nl 6877 [2001:888:2000:d::a6]:33971
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19009

Show key headers only | View raw


> here is my code :
> import urllib
> import lxml.html
> down='http://download.v.163.com/dl/open/00DL0QDR0QDS0QHH.html'
> file=urllib.urlopen(down).
> read()
> root=lxml.html.document_fromstring(file)
> tnodes = root.xpath("//a/@href[contains(string(),'mp4')]")
> for i,add in enumerate(tnodes):
>     print  i,add
>
> why i can get nothing?

What version of python is this?  Based on the naked "print" I guess
2.x, and I got:

$ /opt/python2/bin/python2.7
Python 2.7.2 (default, Oct 10 2011, 03:43:34)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxml.html
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named lxml.html

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


Thread

Re: why i can get nothing? Jason Friedman <jason@powerpull.net> - 2012-01-15 15:40 +0000

csiph-web