[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]*)?|'