Diff
checker
文本
文本
图像
文档
Excel
文件夹
Legal
Enterprise
桌面版
定价
登录
下载 Diffchecker 桌面版
比较文本
查找两个文本文件之间的差异
工具
历史
实时编辑器
折叠未更改行
关闭换行
视图
拆分
统一
比对精度
智能
单词
字符
语法高亮
选择语法
忽略
文本转换
转到第一个差异
编辑输入
Diffchecker Desktop
运行Diffchecker最安全的方式。获取Diffchecker桌面应用:您的差异永远不会离开您的电脑!
获取桌面版
Untitled diff
创建于
11年前
差异永不过期
清除
导出
分享
解释
11 删除
行
总计
删除
字符
总计
删除
要继续使用此功能,请升级到
Diff
checker
Pro
查看价格
20 行
全部复制
10 添加
行
总计
添加
字符
总计
添加
要继续使用此功能,请升级到
Diff
checker
Pro
查看价格
20 行
全部复制
def check(types, value):
def check(types, value):
value = int(value)
value = int(value)
复制
已复制
复制
已复制
if types
==
"cats:"
or types ==
"trees:"
:
if types
in (
"cats:"
,
"trees:"
)
:
return props[types] < value
return props[types] < value
复制
已复制
复制
已复制
elif types
==
"pomeranians:"
or types ==
"goldfish:"
:
elif types
in (
"pomeranians:"
,
"goldfish:"
)
:
return props[types] > value
return props[types] > value
return props[types] == value
return props[types] == value
props = {}
props = {}
with open("inpt.txt") as g:
with open("inpt.txt") as g:
for line in g:
for line in g:
复制
已复制
复制
已复制
line = line.strip(
"\n"
).split(
" "
)
line = line.strip(
).split(
)
props[line[0]] = int(line[1])
props[line[0]] = int(line[1])
with open("input16.txt") as f:
with open("input16.txt") as f:
for line in f:
for line in f:
复制
已复制
复制
已复制
line = line.strip(
"\n"
).split(
" "
)
line = line.strip(
).split(
)
if
(check(line[
2
], line[
3
].strip(","))
and check(line[4], line[5].strip(",")) and check(line[6], line[7]
)):
if
all
(check(line[
i
], line[
i+1
].strip(","))
for i in range(2,7,2
)):
print line
print line
已保存差异
原始文本
打开文件
def check(types, value): value = int(value) if types == "cats:" or types == "trees:": return props[types] < value elif types == "pomeranians:" or types == "goldfish:": return props[types] > value return props[types] == value props = {} with open("inpt.txt") as g: for line in g: line = line.strip("\n").split(" ") props[line[0]] = int(line[1]) with open("input16.txt") as f: for line in f: line = line.strip("\n").split(" ") if (check(line[2], line[3].strip(",")) and check(line[4], line[5].strip(",")) and check(line[6], line[7])): print line
更改后文本
打开文件
def check(types, value): value = int(value) if types in ("cats:", "trees:"): return props[types] < value elif types in ("pomeranians:", "goldfish:"): return props[types] > value return props[types] == value props = {} with open("inpt.txt") as g: for line in g: line = line.strip().split() props[line[0]] = int(line[1]) with open("input16.txt") as f: for line in f: line = line.strip().split() if all(check(line[i], line[i+1].strip(",")) for i in range(2,7,2)): print line
查找差异