Python 3.8 错误
ImportError: cannot import name 'mydb' from partially initialized module 'connection'
(most likely due to a circular import) (C:\U
sers\Mark04\Documents\Python tutorial\databasing\connection.py)
Run Code Online (Sandbox Code Playgroud)
当我尝试执行子模块 select.py
import bcrypt;
from connection import mydb
Run Code Online (Sandbox Code Playgroud)
那有一个导入的模块 connection.py
import mysql.connector
mydb = "Success";
Run Code Online (Sandbox Code Playgroud)
我不知道是什么问题。当我从我的模块 connection.py 中删除 import mysql.connector 时没有出现错误,但它没有解决我的问题。
> python -m select
Run Code Online (Sandbox Code Playgroud) 我使用 difflib 并尝试比较两个句子并找出差异。
有点像这样。
我有这段代码,但它不是逐字分析,而是逐字分析。
import difflib
# define original text
# taken from: https://en.wikipedia.org/wiki/Internet_Information_Services
original = ["IIS 8.5 has several improvements related"]
# define modified text
edited = ["It has several improvements related"]
# initiate the Differ object
d = difflib.Differ()
# calculate the difference between the two texts
diff = d.compare(original, edited)
# output the result
print ('\n'.join(diff))
Run Code Online (Sandbox Code Playgroud)