Python implements the intersection of two csv files,
This example describes how to use Python to calculate the intersection of two csv files. We will share this with you for your reference. The details are as follows:
#! /Usr/bin/env pythonrd3 = open('data_17_17_2.csv ') base = open('data_17_17_3.csv') wr3 = comment ', 'W +') bsData = base. readlines () I = 1for key in rd3: if key in bsData: wr3.write (key) if I = 1: print key I = (I + 1) % 100rd3. close () base. close () wr3.close ()
For more Python-related content, refer to this topic: python Excel table skill summary, Python coding skill summary, Python data structure and algorithm tutorial, Python function usage skill summary, and Python string operation skill Summary "," Python entry and advanced classic tutorial "and" Python file and directory operation tips summary"
I hope this article will help you with Python programming.