import csv
def main():
old_file = 'oldfile.txt'
new_file = 'newfile.txt'
# Create sets to store the unique values from each file
old_set = set()
new_set = set()
# Open the old file and add the first column of each row to the old_set
with open(old_file, 'r') as f:
reader = csv.reader(f)
for row in reader:
old_set.add(row)
# Open the new file and add the first column of each row to the new_set
with open(new_file, 'r') as f:
reader = csv.reader(f)
for row in reader:
new_set.add(row)
# Print the missing values
print(missing_values)
if __name__ == "__main__":
main()
1条答案
按热度按时间vcirk6k61#
对于这个文件,其中一个文件中可能存在间距差异或一些Unicode字符,这可能会导致您出现问题。
我有一个python脚本,它给了我两个文件之间的区别,希望这对你有帮助。
如果你没有看到任何打印出来的东西,试着颠倒文件名,这可能是一种方式或其他。希望这能有所帮助