读书人

[d]一个python的资料 在windows下好使

发布时间: 2013-03-26 09:54:34 作者: rapoo

[d]一个python的文件 在windows下好使 在linux下运行不好使
本帖最后由 fibbery 于 2012-09-30 22:44:54 编辑 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('[&<]')



源码前几行:


"""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 re
import string

__all__ = ["SGMLParser"]

# Regular expressions used for parsing

interesting = 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

热点推荐