我试图在同一时间运行两个for循环,并从每一个传球的决定。该循环通过搜索SQL文件,并抓住每行进行比较。
我试过,没有运气一起编织循环。如果任何人有关于如何做到这一点还是如何实现多线程方法的建议。 (我从来没有尝试过的多线程)
for row in rows:
print(row)
KnowNextRow = nextrowfinder(str(row))
print(KnowNextRow)
for perrow in perrows:
PerfectNextRow = perrow
print(str(PerfectNextRow))
Search_Procedure(str(row))
#Then compare see if KnowNextRow == PerfectNextRow after each pass else: {Code}
我能得到什么,如果我要与运行这个if语句是从拉for循环的最后一排的决定。我想这样做是比较各线,并通过上线的基础线的决定。
我不认为你需要多线程来得到的结果你是经过。只要把输出到Python的列表,并通过循环使用枚举函数:
rows_list = []
perrows_list = []
for row in rows:
print(row)
KnowNextRow = nextrowfinder(str(row))
rows_list.append(KnowNextRow)
for perrow in perrows:
PerfectNextRow = perrow
xx = (str(PerfectNextRow))
perrows_list.append(xx)
rows_len = len(rows_list) #Get length of lists to ensure they are the same
perlen = len(perrows_list)
for idx, item in enumerate(rows_list):
if idx < (perlen - 1) # Check that perrows item exists
if item == perrows_list[idx]
print("Rows Match At Row# " + idx)