From 78fa083216b120f65dbdbeef3377a047f1767fce Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Tue, 12 Dec 2000 23:20:45 +0000 Subject: Update the code to better reflect recommended style: Use != instead of <> since <> is documented as "obsolescent". Use "is" and "is not" when comparing with None or type objects. --- Lib/Cookie.py | 2 +- Lib/binhex.py | 6 +++--- Lib/calendar.py | 2 +- Lib/cmd.py | 2 +- Lib/commands.py | 2 +- Lib/dircache.py | 2 +- Lib/dospath.py | 6 +++--- Lib/filecmp.py | 5 +++-- Lib/ftplib.py | 24 ++++++++++++------------ Lib/imputil.py | 4 ++-- Lib/linecache.py | 2 +- Lib/macpath.py | 6 +++--- Lib/macurl2path.py | 4 ++-- Lib/mailbox.py | 2 +- Lib/mailcap.py | 4 ++-- Lib/mhlib.py | 2 +- Lib/mimetools.py | 6 +++--- Lib/multifile.py | 2 +- Lib/netrc.py | 2 +- Lib/nntplib.py | 12 ++++++------ Lib/ntpath.py | 6 +++--- Lib/pdb.py | 5 +++-- Lib/pipes.py | 14 +++++++------- Lib/posixpath.py | 8 ++++---- Lib/quopri.py | 2 +- Lib/regsub.py | 6 +++--- Lib/sgmllib.py | 4 ++-- Lib/smtplib.py | 12 ++++++------ Lib/sndhdr.py | 10 +++++----- Lib/statcache.py | 6 +++--- Lib/sunaudio.py | 2 +- Lib/toaiff.py | 6 +++--- Lib/tzparse.py | 2 +- Lib/uu.py | 12 ++++++------ Lib/xdrlib.py | 4 ++-- Lib/xmllib.py | 4 ++-- 36 files changed, 101 insertions(+), 99 deletions(-) (limited to 'Lib') diff --git a/Lib/Cookie.py b/Lib/Cookie.py index 67259af5f6..223e71502a 100644 --- a/Lib/Cookie.py +++ b/Lib/Cookie.py @@ -489,7 +489,7 @@ class Morsel(UserDict): RA("%s=%s;" % (self.key, self.coded_value)) # Now add any defined attributes - if attrs == None: + if attrs is None: attrs = self._reserved_keys for K,V in self.items(): if V == "": continue diff --git a/Lib/binhex.py b/Lib/binhex.py index 08922031e1..fe695ac5a7 100644 --- a/Lib/binhex.py +++ b/Lib/binhex.py @@ -189,7 +189,7 @@ class BinHex: hqxer = _Hqxcoderengine(ofp) self.ofp = _Rlecoderengine(hqxer) self.crc = 0 - if finfo == None: + if finfo is None: finfo = FInfo() self.dlen = dlen self.rlen = rlen @@ -228,7 +228,7 @@ class BinHex: self._write(data) def close_data(self): - if self.dlen <> 0: + if self.dlen != 0: raise Error, 'Incorrect data size, diff='+`self.rlen` self._writecrc() self.state = _DID_DATA @@ -246,7 +246,7 @@ class BinHex: self.close_data() if self.state != _DID_DATA: raise Error, 'Close at the wrong time' - if self.rlen <> 0: + if self.rlen != 0: raise Error, \ "Incorrect resource-datasize, diff="+`self.rlen` self._writecrc() diff --git a/Lib/calendar.py b/Lib/calendar.py index 41bb191478..01c21947a9 100644 --- a/Lib/calendar.py +++ b/Lib/calendar.py @@ -50,7 +50,7 @@ def setfirstweekday(weekday): def isleap(year): """Return 1 for leap years, 0 for non-leap years.""" - return year % 4 == 0 and (year % 100 <> 0 or year % 400 == 0) + return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) def leapdays(y1, y2): """Return number of leap years in range [y1, y2). diff --git a/Lib/cmd.py b/Lib/cmd.py index 41b229325a..7671573953 100644 --- a/Lib/cmd.py +++ b/Lib/cmd.py @@ -57,7 +57,7 @@ class Cmd: def cmdloop(self, intro=None): self.preloop() - if intro != None: + if intro is not None: self.intro = intro if self.intro: print self.intro diff --git a/Lib/commands.py b/Lib/commands.py index 12acc36408..99387b1053 100644 --- a/Lib/commands.py +++ b/Lib/commands.py @@ -51,7 +51,7 @@ def getstatusoutput(cmd): pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r') text = pipe.read() sts = pipe.close() - if sts == None: sts = 0 + if sts is None: sts = 0 if text[-1:] == '\n': text = text[:-1] return sts, text diff --git a/Lib/dircache.py b/Lib/dircache.py index a35e16d1bc..08b127a1af 100644 --- a/Lib/dircache.py +++ b/Lib/dircache.py @@ -19,7 +19,7 @@ def listdir(path): mtime = os.stat(path)[8] except os.error: return [] - if mtime <> cached_mtime: + if mtime != cached_mtime: try: list = os.listdir(path) except os.error: diff --git a/Lib/dospath.py b/Lib/dospath.py index f44d499e53..17db624e83 100644 --- a/Lib/dospath.py +++ b/Lib/dospath.py @@ -108,7 +108,7 @@ def commonprefix(m): prefix = m[0] for item in m: for i in range(len(prefix)): - if prefix[:i+1] <> item[:i+1]: + if prefix[:i+1] != item[:i+1]: prefix = prefix[:i] if i == 0: return '' break @@ -210,7 +210,7 @@ def expanduser(path): (A function should also be defined to do full *sh-style environment variable expansion.)""" - if path[:1] <> '~': + if path[:1] != '~': return path i, n = 1, len(path) while i < n and path[i] not in '/\\': @@ -303,7 +303,7 @@ def normpath(path): comps[i-1] not in ('', '..'): del comps[i-1:i+1] i = i - 1 - elif comps[i] == '' and i > 0 and comps[i-1] <> '': + elif comps[i] == '' and i > 0 and comps[i-1] != '': del comps[i] elif '.' in comps[i]: comp = comps[i].split('.') diff --git a/Lib/filecmp.py b/Lib/filecmp.py index e5024a493a..eb98a71cc4 100644 --- a/Lib/filecmp.py +++ b/Lib/filecmp.py @@ -199,7 +199,7 @@ class dircmp: if ok: a_type = stat.S_IFMT(a_stat[stat.ST_MODE]) b_type = stat.S_IFMT(b_stat[stat.ST_MODE]) - if a_type <> b_type: + if a_type != b_type: self.common_funny.append(x) elif stat.S_ISDIR(a_type): self.common_dirs.append(x) @@ -317,7 +317,8 @@ def demo(): import sys import getopt options, args = getopt.getopt(sys.argv[1:], 'r') - if len(args) <> 2: raise getopt.error, 'need exactly two args' + if len(args) != 2: + raise getopt.error, 'need exactly two args' dd = dircmp(args[0], args[1]) if ('-r', '') in options: dd.report_full_closure() diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 429e834a93..df28200394 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -185,7 +185,7 @@ class FTP: nextline = self.getline() line = line + ('\n' + nextline) if nextline[:3] == code and \ - nextline[3:4] <> '-': + nextline[3:4] != '-': break return line @@ -207,7 +207,7 @@ class FTP: def voidresp(self): """Expect a response beginning with '2'.""" resp = self.getresp() - if resp[0] <> '2': + if resp[0] != '2': raise error_reply, resp return resp @@ -277,14 +277,14 @@ class FTP: if rest is not None: self.sendcmd("REST %s" % rest) resp = self.sendcmd(cmd) - if resp[0] <> '1': + if resp[0] != '1': raise error_reply, resp else: sock = self.makeport() if rest is not None: self.sendcmd("REST %s" % rest) resp = self.sendcmd(cmd) - if resp[0] <> '1': + if resp[0] != '1': raise error_reply, resp conn, sockaddr = sock.accept() if resp[:3] == '150': @@ -318,7 +318,7 @@ class FTP: resp = self.sendcmd('USER ' + user) if resp[0] == '3': resp = self.sendcmd('PASS ' + passwd) if resp[0] == '3': resp = self.sendcmd('ACCT ' + acct) - if resp[0] <> '2': + if resp[0] != '2': raise error_reply, resp return resp @@ -384,7 +384,7 @@ class FTP: while 1: buf = fp.readline() if not buf: break - if buf[-2:] <> CRLF: + if buf[-2:] != CRLF: if buf[-1] in CRLF: buf = buf[:-1] buf = buf + CRLF conn.send(buf) @@ -423,7 +423,7 @@ class FTP: def rename(self, fromname, toname): '''Rename a file.''' resp = self.sendcmd('RNFR ' + fromname) - if resp[0] <> '3': + if resp[0] != '3': raise error_reply, resp return self.voidcmd('RNTO ' + toname) @@ -508,7 +508,7 @@ def parse227(resp): Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)' Return ('host.addr.as.numbers', port#) tuple.''' - if resp[:3] <> '227': + if resp[:3] != '227': raise error_reply, resp left = string.find(resp, '(') if left < 0: raise error_proto, resp @@ -516,7 +516,7 @@ def parse227(resp): if right < 0: raise error_proto, resp # should contain '(h1,h2,h3,h4,p1,p2)' numbers = string.split(resp[left+1:right], ',') - if len(numbers) <> 6: + if len(numbers) != 6: raise error_proto, resp host = string.join(numbers[:4], '.') port = (string.atoi(numbers[4]) << 8) + string.atoi(numbers[5]) @@ -528,9 +528,9 @@ def parse257(resp): This is a response to a MKD or PWD request: a directory name. Returns the directoryname in the 257 reply.''' - if resp[:3] <> '257': + if resp[:3] != '257': raise error_reply, resp - if resp[3:5] <> ' "': + if resp[3:5] != ' "': return '' # Not compliant to RFC 959, but UNIX ftpd does this dirname = '' i = 5 @@ -539,7 +539,7 @@ def parse257(resp): c = resp[i] i = i+1 if c == '"': - if i >= n or resp[i] <> '"': + if i >= n or resp[i] != '"': break i = i+1 dirname = dirname + c diff --git a/Lib/imputil.py b/Lib/imputil.py index d442d9fa22..0dd7b51eb1 100644 --- a/Lib/imputil.py +++ b/Lib/imputil.py @@ -434,7 +434,7 @@ def _os_bootstrap(): path = s if ':' not in a: a = ':' + a - if a[-1:] <> ':': + if a[-1:] != ':': a = a + ':' return a + b else: @@ -643,7 +643,7 @@ def _test_revamp(): # from Guido: # need to change sys.* references for rexec environs # need hook for MAL's walk-me-up import strategy, or Tim's absolute strategy -# watch out for sys.modules[...] == None +# watch out for sys.modules[...] is None # flag to force absolute imports? (speeds _determine_import_context and # checking for a relative module) # insert names of archives into sys.path (see quote below) diff --git a/Lib/linecache.py b/Lib/linecache.py index bca40b291c..c39f8db595 100644 --- a/Lib/linecache.py +++ b/Lib/linecache.py @@ -50,7 +50,7 @@ def checkcache(): except os.error: del cache[filename] continue - if size <> stat[ST_SIZE] or mtime <> stat[ST_MTIME]: + if size != stat[ST_SIZE] or mtime != stat[ST_MTIME]: del cache[filename] diff --git a/Lib/macpath.py b/Lib/macpath.py index 12eec0c97e..bf2660f4f1 100644 --- a/Lib/macpath.py +++ b/Lib/macpath.py @@ -17,7 +17,7 @@ def isabs(s): Anything else is absolute (the string up to the first colon is the volume name).""" - return ':' in s and s[0] <> ':' + return ':' in s and s[0] != ':' def join(s, *p): @@ -30,7 +30,7 @@ def join(s, *p): t = t[1:] if ':' not in path: path = ':' + path - if path[-1:] <> ':': + if path[-1:] != ':': path = path + ':' path = path + t return path @@ -151,7 +151,7 @@ def commonprefix(m): prefix = m[0] for item in m: for i in range(len(prefix)): - if prefix[:i+1] <> item[:i+1]: + if prefix[:i+1] != item[:i+1]: prefix = prefix[:i] if i == 0: return '' break diff --git a/Lib/macurl2path.py b/Lib/macurl2path.py index c971edaa22..9daeae4a65 100644 --- a/Lib/macurl2path.py +++ b/Lib/macurl2path.py @@ -12,7 +12,7 @@ def url2pathname(pathname): # XXXX The .. handling should be fixed... # tp = urllib.splittype(pathname)[0] - if tp and tp <> 'file': + if tp and tp != 'file': raise RuntimeError, 'Cannot convert non-local URL to pathname' # Turn starting /// into /, an empty hostname means current host if pathname[:3] == '///': @@ -29,7 +29,7 @@ def url2pathname(pathname): components[i-1] not in ('', '..'): del components[i-1:i+1] i = i-1 - elif components[i] == '' and i > 0 and components[i-1] <> '': + elif components[i] == '' and i > 0 and components[i-1] != '': del components[i] else: i = i+1 diff --git a/Lib/mailbox.py b/Lib/mailbox.py index c92e1452e4..53b2c19f61 100755 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -30,7 +30,7 @@ class _Mailbox: start = self.fp.tell() self._search_end() self.seekp = stop = self.fp.tell() - if start <> stop: + if start != stop: break return rfc822.Message(_Subfile(self.fp, start, stop)) diff --git a/Lib/mailcap.py b/Lib/mailcap.py index 636f2dd244..9756594cb8 100644 --- a/Lib/mailcap.py +++ b/Lib/mailcap.py @@ -173,7 +173,7 @@ def subst(field, MIMEtype, filename, plist=[]): i, n = 0, len(field) while i < n: c = field[i]; i = i+1 - if c <> '%': + if c != '%': if c == '\\': c = field[i:i+1]; i = i+1 res = res + c @@ -187,7 +187,7 @@ def subst(field, MIMEtype, filename, plist=[]): res = res + MIMEtype elif c == '{': start = i - while i < n and field[i] <> '}': + while i < n and field[i] != '}': i = i+1 name = field[start:i] i = i+1 diff --git a/Lib/mhlib.py b/Lib/mhlib.py index df538f274e..f5ece05e34 100644 --- a/Lib/mhlib.py +++ b/Lib/mhlib.py @@ -305,7 +305,7 @@ class Folder: line = f.readline() if not line: break fields = string.splitfields(line, ':') - if len(fields) <> 2: + if len(fields) != 2: self.error('bad sequence in %s: %s' % (fullname, string.strip(line))) key = string.strip(fields[0]) diff --git a/Lib/mimetools.py b/Lib/mimetools.py index da955af05d..abdfa62fbb 100644 --- a/Lib/mimetools.py +++ b/Lib/mimetools.py @@ -22,7 +22,7 @@ class Message(rfc822.Message): def parsetype(self): str = self.typeheader - if str == None: + if str is None: str = 'text/plain' if ';' in str: i = string.index(str, ';') @@ -75,7 +75,7 @@ class Message(rfc822.Message): return result def getencoding(self): - if self.encodingheader == None: + if self.encodingheader is None: return '7bit' return string.lower(self.encodingheader) @@ -109,7 +109,7 @@ def choose_boundary(): global _prefix import time import random - if _prefix == None: + if _prefix is None: import socket import os hostid = socket.gethostbyname(socket.gethostname()) diff --git a/Lib/multifile.py b/Lib/multifile.py index e43d331c57..54de947798 100644 --- a/Lib/multifile.py +++ b/Lib/multifile.py @@ -155,7 +155,7 @@ class MultiFile: self.lastpos = abslastpos - self.start def is_data(self, line): - return line[:2] <> '--' + return line[:2] != '--' def section_divider(self, str): return "--" + str diff --git a/Lib/netrc.py b/Lib/netrc.py index c46ba73190..e3374b062a 100644 --- a/Lib/netrc.py +++ b/Lib/netrc.py @@ -17,7 +17,7 @@ class netrc: while 1: # Look for a machine, default, or macdef top-level keyword toplevel = tt = lexer.get_token() - if tt == '' or tt == None: + if not tt: break elif tt == 'machine': entryname = lexer.get_token() diff --git a/Lib/nntplib.py b/Lib/nntplib.py index 7a90543db3..526677a95c 100644 --- a/Lib/nntplib.py +++ b/Lib/nntplib.py @@ -258,7 +258,7 @@ class NNTP: - name: the group name""" resp = self.shortcmd('GROUP ' + name) - if resp[:3] <> '211': + if resp[:3] != '211': raise NNTPReplyError(resp) words = string.split(resp) count = first = last = 0 @@ -282,7 +282,7 @@ class NNTP: def statparse(self, resp): """Internal: parse the response of a STAT, NEXT or LAST command.""" - if resp[:2] <> '22': + if resp[:2] != '22': raise NNTPReplyError(resp) words = string.split(resp) nr = 0 @@ -429,7 +429,7 @@ class NNTP: path: directory path to article""" resp = self.shortcmd("XPATH " + id) - if resp[:3] <> '223': + if resp[:3] != '223': raise NNTPReplyError(resp) try: [resp_num, path] = string.split(resp) @@ -447,7 +447,7 @@ class NNTP: time: Time suitable for newnews/newgroups commands etc.""" resp = self.shortcmd("DATE") - if resp[:3] <> '111': + if resp[:3] != '111': raise NNTPReplyError(resp) elem = string.split(resp) if len(elem) != 2: @@ -467,7 +467,7 @@ class NNTP: resp = self.shortcmd('POST') # Raises error_??? if posting is not allowed - if resp[0] <> '3': + if resp[0] != '3': raise NNTPReplyError(resp) while 1: line = f.readline() @@ -491,7 +491,7 @@ class NNTP: resp = self.shortcmd('IHAVE ' + id) # Raises error_??? if the server already has it - if resp[0] <> '3': + if resp[0] != '3': raise NNTPReplyError(resp) while 1: line = f.readline() diff --git a/Lib/ntpath.py b/Lib/ntpath.py index efcba6df92..c1f4df7d4c 100644 --- a/Lib/ntpath.py +++ b/Lib/ntpath.py @@ -160,7 +160,7 @@ def commonprefix(m): prefix = m[0] for item in m: for i in range(len(prefix)): - if prefix[:i+1] <> item[:i+1]: + if prefix[:i+1] != item[:i+1]: prefix = prefix[:i] if i == 0: return '' break @@ -283,7 +283,7 @@ def expanduser(path): """Expand ~ and ~user constructs. If user or $HOME is unknown, do nothing.""" - if path[:1] <> '~': + if path[:1] != '~': return path i, n = 1, len(path) while i < n and path[i] not in '/\\': @@ -387,7 +387,7 @@ def normpath(path): elif comps[i] == '..' and i > 0 and comps[i-1] not in ('', '..'): del comps[i-1:i+1] i = i - 1 - elif comps[i] == '' and i > 0 and comps[i-1] <> '': + elif comps[i] == '' and i > 0 and comps[i-1] != '': del comps[i] else: i = i + 1 diff --git a/Lib/pdb.py b/Lib/pdb.py index db4a2cde61..f4a0c89f4c 100755 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -553,7 +553,7 @@ class Pdb(bdb.Bdb, cmd.Cmd): first = max(1, self.curframe.f_lineno - 5) else: first = self.lineno + 1 - if last == None: + if last is None: last = first + 10 filename = self.curframe.f_code.co_filename breaklist = self.get_file_breaks(filename) @@ -895,7 +895,8 @@ def set_trace(): def post_mortem(t): p = Pdb() p.reset() - while t.tb_next <> None: t = t.tb_next + while t.tb_next is not None: + t = t.tb_next p.interaction(t.tb_frame, t) def pm(): diff --git a/Lib/pipes.py b/Lib/pipes.py index 4057fac077..3aa1bf1f22 100644 --- a/Lib/pipes.py +++ b/Lib/pipes.py @@ -110,7 +110,7 @@ class Template: def append(self, cmd, kind): """t.append(cmd, kind) adds a new step at the end.""" - if type(cmd) <> type(''): + if type(cmd) is not type(''): raise TypeError, \ 'Template.append: cmd must be a string' if kind not in stepkinds: @@ -119,7 +119,7 @@ class Template: if kind == SOURCE: raise ValueError, \ 'Template.append: SOURCE can only be prepended' - if self.steps <> [] and self.steps[-1][1] == SINK: + if self.steps and self.steps[-1][1] == SINK: raise ValueError, \ 'Template.append: already ends with SINK' if kind[0] == 'f' and not re.search('\$IN\b', cmd): @@ -132,7 +132,7 @@ class Template: def prepend(self, cmd, kind): """t.prepend(cmd, kind) adds a new step at the front.""" - if type(cmd) <> type(''): + if type(cmd) is not type(''): raise TypeError, \ 'Template.prepend: cmd must be a string' if kind not in stepkinds: @@ -141,7 +141,7 @@ class Template: if kind == SINK: raise ValueError, \ 'Template.prepend: SINK can only be appended' - if self.steps <> [] and self.steps[0][1] == SOURCE: + if self.steps and self.steps[0][1] == SOURCE: raise ValueError, \ 'Template.prepend: already begins with SOURCE' if kind[0] == 'f' and not re.search('\$IN\b', cmd): @@ -165,7 +165,7 @@ class Template: def open_r(self, file): """t.open_r(file) and t.open_w(file) implement t.open(file, 'r') and t.open(file, 'w') respectively.""" - if self.steps == []: + if not self.steps: return open(file, 'r') if self.steps[-1][1] == SINK: raise ValueError, \ @@ -174,7 +174,7 @@ class Template: return os.popen(cmd, 'r') def open_w(self, file): - if self.steps == []: + if not self.steps: return open(file, 'w') if self.steps[0][1] == SOURCE: raise ValueError, \ @@ -203,7 +203,7 @@ def makepipeline(infile, steps, outfile): # # Make sure there is at least one step # - if list == []: + if not list: list.append(['', 'cat', '--', '']) # # Take care of the input and output ends diff --git a/Lib/posixpath.py b/Lib/posixpath.py index 2826604821..32850b4ba7 100644 --- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -59,7 +59,7 @@ def split(p): everything after the final slash. Either part may be empty.""" i = p.rfind('/') + 1 head, tail = p[:i], p[i:] - if head and head <> '/'*len(head): + if head and head != '/'*len(head): while head[-1] == '/': head = head[:-1] return head, tail @@ -120,7 +120,7 @@ def commonprefix(m): prefix = m[0] for item in m: for i in range(len(prefix)): - if prefix[:i+1] <> item[:i+1]: + if prefix[:i+1] != item[:i+1]: prefix = prefix[:i] if i == 0: return '' break @@ -281,10 +281,10 @@ def walk(top, func, arg): def expanduser(path): """Expand ~ and ~user constructions. If user or $HOME is unknown, do nothing.""" - if path[:1] <> '~': + if path[:1] != '~': return path i, n = 1, len(path) - while i < n and path[i] <> '/': + while i < n and path[i] != '/': i = i + 1 if i == 1: if not os.environ.has_key('HOME'): diff --git a/Lib/quopri.py b/Lib/quopri.py index b449792e40..80fc6f911f 100755 --- a/Lib/quopri.py +++ b/Lib/quopri.py @@ -69,7 +69,7 @@ def decode(input, output): partial = 1 while i < n: c = line[i] - if c <> ESCAPE: + if c != ESCAPE: new = new + c; i = i+1 elif i+1 == n and not partial: partial = 1; break diff --git a/Lib/regsub.py b/Lib/regsub.py index 8e341bb758..dc95028b34 100644 --- a/Lib/regsub.py +++ b/Lib/regsub.py @@ -124,7 +124,7 @@ def capwords(str, pat='[^a-zA-Z0-9_]+'): cache = {} def compile(pat): - if type(pat) <> type(''): + if type(pat) != type(''): return pat # Assume it is a compiled regex key = (pat, regex.get_syntax()) if cache.has_key(key): @@ -153,7 +153,7 @@ def expand(repl, regs, str): ord0 = ord('0') while i < len(repl): c = repl[i]; i = i+1 - if c <> '\\' or i >= len(repl): + if c != '\\' or i >= len(repl): new = new + c else: c = repl[i]; i = i+1 @@ -182,7 +182,7 @@ def test(): if not line: break if line[-1] == '\n': line = line[:-1] fields = split(line, delpat) - if len(fields) <> 3: + if len(fields) != 3: print 'Sorry, not three fields' print 'split:', `fields` continue diff --git a/Lib/sgmllib.py b/Lib/sgmllib.py index d7e8319523..c1467b08e2 100644 --- a/Lib/sgmllib.py +++ b/Lib/sgmllib.py @@ -185,7 +185,7 @@ class SGMLParser: # Internal -- parse comment, return length or -1 if not terminated def parse_comment(self, i): rawdata = self.rawdata - if rawdata[i:i+4] <> '