On 10/23/2011 9:59 AM, 水静流深 wrote:
i change my code into :
Calling your file xml.py (as indicated below) is a potentially bad idea
since the Python stdlib has a package named 'xml'. If you write 'import
xml.xxx' in another file in the same directory, Python will try to find
'xxx' in your xml
on c:\xml.py
Traceback (most recent call last):
File "c:\xml.py", line 5, in
root=lxml.html.fromstring(root)
File "C:\Python32\lib\site-packages\lxml\html\__init__.py", line 630, in froms
tring
if start.startswith(';
发送时间: 2011年10月23日(星期天) 晚上9:48
收件人: "水
2011/10/23 水静流深 <1248283...@qq.com>:
> book=open('c:\'+str1,'w') # i change it
> when i run it in python32,the output is :
> book=open('c:\'+str1,'w')
> invalid syntax,what is wrong?
Your problem is not at all Python 3-specific.
Backslashes are used for escape sequences in string l
code 1 can run in python2.6
#coding:utf-8
import urllib
import lxml.html
down='http://frux.wikispaces.com/'
root=urllib.urlopen(down).read()
root=lxml.html.fromstring(root)
file=root.xpath('//a')
for i in file:
str1=i.text_content()
if str1.find('pdf') >-1 :
str2='http://frux.wi