problem using differ

Gary Richardson garyr at
Wed Nov 26 22:43:39 CET 2003

"Russell" <rphaturos at> wrote in message
news:vsa5jn2060qe24 at
> I'm trying to automate the comparison of some source code but I'm having
> trouble using the differ object.  I'm new to Python so I'm probably doing
> something wrong.  I've created a small program (included below) that
> demonstrates my problem.  For some reason, Python doesn't recognize
> I keep getting this error: NameError: name 'differ' is not defined.  What
> I doing wrong?
> Test Code follows:
> import difflib
> a=[]
> a.append('1. Beautiful is better than ugly.')
> a.append('2. Explicit is better than implicit.')
> a.append('3. Simple is better than complex.')
> a.append('4. Complex is better than complicated.')
> b=[]
> b.append('1. Beautiful is better than ugly.')
> b.append('3.   Simple is better than complex.')
> b.append('4. Complicated is better than complex.')
> b.append('5. Flat is better than nested.')
> d=differ()
for k in range(4):
 dif =[k], b[k])
 for p in dif:
  print p,

More information about the Python-list mailing list