1
I’m trying to get one nested to compare lines in two different csv files, but after the first interaction of the first file is searched inside the second file and skip to the second iteration, the for2 stops running and only the for1 continues. Would anyone know why?
def evolution(token, evolution_results):
files_name = open("file_name_results/" + token + "_match_file.csv")
results = open("results/" + token + "_results.csv")
for line1 in files_name:
print("Inicio iteração")
line1 = line1.replace("\n","")
if line1=="file" or line1=="":
print("Fim iteração")
continue
print("Buscando "+line1)
for line2 in results:
line2 = line2.replace("\n","")
if re.search('(=?' + ''.join(line1).strip() + ')', line2, re.IGNORECASE):
# evolution_results.write(line2+"\n")
print(line2)
print("Fim iteração")
print("Saiu do for")
files_name.close()
results.close()
Obs: in the for1 file the first two lines will always be skipped
Exit
Start iteration End iteration Start iteration End iteration
Home iteration Searching github_repos/Bancor/solidity/Contracts/Safemath.sol
c527907d648afdee3aa4f9ad2d6c44c5fdb2130a,github_repos/Bancor/solidity/Contracts/Safemath.sol,99 317c0702eefe3909cbbaa53094340292a39c0ad4,github_repos/Bancor/solidity/Contracts/Safemath.sol,99 b3935bb97eea724fd536ce87deaff53629e5aa25,github_repos/Bancor/solidity/Contracts/Safemath.sol,99 3ffe6c9edb11b506817587ca5ab8b9913abd87d0,github_repos/Bancor/solidity/Contracts/Safemath.sol,99 34d71ebe3777a2d9e0650b2e1f462def0e0096f0,github_repos/Bancor/solidity/Contracts/Safemath.sol,99 12dd35e3d80115e23893a4ad07b0d6edc9f25403,github_repos/Bancor/solidity/Contracts/Safemath.sol,99 85de77f365bc4fb8b269c45e983cc3a2cc5823d3,github_repos/Bancor/solidity/Contracts/Safemath.sol,99 1cfb8d0957462a7f7fe289471b9e7863d32e2aab,github_repos/Bancor/solidity/Contracts/Safemath.sol,100 b1137aaa2536973339e8e4cd07d1129eefc0879c,github_repos/Bancor/solidity/Contracts/Safemath.sol,100 7d2956a7a2b4209a0620ed0be1aa8be16f210cb6,github_repos/Bancor/solidity/Contracts/Safemath.sol,100 ce4b8dac9a0b5a76c5f09bd94ffe6f86f8dc9c62,github_repos/Bancor/solidity/Contracts/Safemath.sol,100 End iteration Start iteration Searching github_repos/Bancor/solidity/Contracts/Ierc20token.sol End iteration Home iteration Searching github_repos/Bancor/solidity/Contracts/Iowned.sol End iteration
Home iteration Searching github_repos/Bancor/solidity/Contracts/Smarttoken.sol End iteration
Came out of the closet
You know what generators are in Python?
– Woss
No, I’m new to the language
– Alan Rodrigues Chaves