Can't import Difflib in python. How can I decide?

I am trying to use difflib but it gives an import error. Can someone help? Here's the trace:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "difflib.py", line 1, in <module>
    from difflib import SequenceMatcher
ImportError: cannot import name SequenceMatcher

      

+3


source to share


1 answer


The solution is not to specify the source file difflib.py

, as in this case Python takes that instead of actually wanting it difflib

.



(Since the question was resolved in the comments and no answer was posted, inspired by the relevant meta question , I am adding this answer to complete the question.I am not trying to get credit from Kevin or BrenBarn , and I am posting it as a community wiki answer.)

+3


source







All Articles