Reo 最近的时间轴更新
Reo

Reo

V2EX 第 95580 号会员,加入于 2015-02-03 19:36:17 +08:00
Reo 最近回复了
@paloalto :Hi paloalto, 我刚学Python, 现在也有一个跟你一样的问题想解决。能把你对于这个问题的代码share一下吗?非常感谢~
我写的代码还是有问题,list_2 中如果某行包含list_1中的某行,这样的就删不掉(我的是把包含的输出到一个文件中),只有当list_2和list_1两行完全一样才被删掉。我的代码如下:
fileOne = open("a.txt", "r").readlines()
fileTwo = open("b.txt", "r").readlines()
outFile = open("c.txt", "w")
for i in fileOne:
for j in fileTwo:
if j in i:
outFile.write(i)
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3588 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 00:06 · PVG 08:06 · LAX 17:06 · JFK 20:06
Developed with CodeLauncher
♥ Do have faith in what you're doing.