读书人

[d]一个python的文件 在windows上好使

发布时间: 2012-10-29 10:03:53 作者: rapoo

[d]一个python的文件 在windows下好使 在linux下运行不好使
linux下的版本是2.4.3
windows下的是2.7
linux下出的错误是:
[root@localhost untitled folder]# ./sgmllib.py 3.html
./sgmllib.py: line 1: A parser for SGML, using the derived class as a static DTD: command not found
: command not found2:
: command not found4:
: command not found9:
: command not found10:
./sgmllib.py: line 11: import: command not found
./sgmllib.py: line 12: import: command not found
: command not found13:
./sgmllib.py: line 14: __all__: command not found
: command not found15:
: command not found17:
./sgmllib.py: line 18: syntax error near unexpected token `('
'/sgmllib.py: line 18: `interesting = re.compile('[&<]')



源码前几行:

Python code
"""A parser for SGML, using the derived class as a static DTD."""# XXX This only supports those SGML features used by HTML.# XXX There should be a way to distinguish between PCDATA (parsed# character data -- the normal case), RCDATA (replaceable character# data -- only char and entity references and end tags are special)# and CDATA (character data -- only end tags are special).import reimport string__all__ = ["SGMLParser"]# Regular expressions used for parsinginteresting = re.compile('[&<]')incomplete = re.compile('&([a-zA-Z][a-zA-Z0-9]*|#[0-9]*)?|'


--------------------
Double行动:
原帖分数:40
帖子加分:40

[解决办法]
更新下python版本到2.7试试
啥linux啊,还2.4呢
[解决办法]
升级到 2.7 试试吧

读书人网 >perl python

热点推荐