小编ABC*_*ABC的帖子

Python:语法错误无效

为什么我在此脚本上出现"无效语法"错误?我正在使用Python 3.3.2 Shell,当我尝试运行模块时,只会弹出一个"无效语法".

import os, re, csv
import email, email.message, email.header

MAILDIR = 'mails'
FEATURES = ['from', 'domain', 'ip', 'country', 'content-type', 'charset', 'reply', 'recipients', 'images', 'urls']

try:
    geoip = False
    import pygeoip
    gi = pygeoip.GeoIP('GeoIP.dat', pygeoip.MEMORY_CACHE)
    geoip = True
except ImportError:
    pass
except IOError:
    print 'GeoIP.dat not found'

class Mail(email.message.Message):
    def count_html_tag(self, tag):
        tags = 0
        for part in email.iterators.typed_subpart_iterator(self, 'text', 'html'):
            html = part.get_payload(decode=True)
            tags += html.lower().count('<' + tag)
        return tags

def feature(self, feature):
    # content-type: plain, html, multipart …
Run Code Online (Sandbox Code Playgroud)

python syntax-error

-4
推荐指数
1
解决办法
5292
查看次数

标签 统计

python ×1

syntax-error ×1