Diff
checker
文本
文本
图像
文档
Excel
文件夹
Legal
Enterprise
桌面版
定价
登录
下载 Diffchecker 桌面版
比较文本
查找两个文本文件之间的差异
工具
历史
显示
视图
拆分
统一
实时编辑器
隐藏空白更改
折叠未更改行
关闭换行
比对精度
智能
语法
无
更改外观
处理
忽略
文本转换
转到第一个差异
编辑输入
Diffchecker Desktop
运行Diffchecker最安全的方式。获取Diffchecker桌面应用:您的差异永远不会离开您的电脑!
获取桌面版
Untitled diff
创建于
10年前
差异永不过期
清除
导出
分享
解释
79 删除
行
总计
删除
字符
总计
删除
要继续使用此功能,请升级到
Diff
checker
Pro
查看价格
90 行
全部复制
100 添加
行
总计
添加
字符
总计
添加
要继续使用此功能,请升级到
Diff
checker
Pro
查看价格
105 行
全部复制
import glob, time, pprint
import glob, time, pprint
a = glob.glob('*.txt')[:1]
a = glob.glob('*.txt')[:1]
复制
已复制
复制
已复制
debug = True #tudo
debug2 = False #tela
debug3 = False #bateria
def postar_bonito(kk):
def postar_bonito(kk):
复制
已复制
复制
已复制
l = []
l = []
x = kk.splitlines()
x = kk.splitlines()
for k in x:
for k in x:
m, o = k.split(' - ')
m, o = k.split(' - ')
o = time.strftime('%d/%m/%Y - %H:%M:%S', time.localtime(int(o)/1000))
o = time.strftime('%d/%m/%Y - %H:%M:%S', time.localtime(int(o)/1000))
if m[0].isdigit(): m += '%'
if m[0].isdigit(): m += '%'
l.append('%s - %s' % (o, m))
l.append('%s - %s' % (o, m))
return '\n'.join(l)
return '\n'.join(l)
def estava_ligado(x):
def estava_ligado(x):
复制
已复制
复制
已复制
m = f.index('tela desligada')
m = f.index('tela desligada')
mm = f.index('tela ligada')
mm = f.index('tela ligada')
return mm > m
return mm > m
def remover_repetidos(s):
def remover_repetidos(s):
复制
已复制
复制
已复制
last = 'lolcopter'
last = 'lolcopter'
k = []
k = []
for i, e in enumerate(s):
for i, e in enumerate(s):
lolcopter = e.split(' - ')[0]
lolcopter = e.split(' - ')[0]
if lolcopter != last:
if lolcopter != last:
k.append(lolcopter)
k.append(lolcopter)
last = lolcopter
last = lolcopter
return k
return k
def estava_carregando(j):
def estava_carregando(j):
复制
已复制
复制
已复制
lol = remover_repetidos([m for m in j.splitlines() if m[0].isdigit()])
lol = remover_repetidos([m for m in j.splitlines() if m[0].isdigit()])
return int(lol[0]) < int(lol[1])
return int(lol[0]) < int(lol[1])
def prettytime(x):
def prettytime(x):
复制
已复制
复制
已复制
return time.strftime('%d/%m/%Y - %H:%M:%S', time.localtime(int(x) / 1000))
return time.strftime('%d/%m/%Y - %H:%M:%S', time.localtime(int(x) / 1000))
def prettytime2(x):
def prettytime2(x):
复制
已复制
复制
已复制
o, k = divmod(x, 60)
o, k = divmod(x, 60)
return '%02d:%02d' % (o, k)
return '%02d:%02d' % (o, k)
def process(
x, y, z):
def process(
n,
x, y, z):
return [
z, prettytime(x), prettytime(y), prettytime2((int(y) - int(x)) / 1000)]
return [
n,
z, prettytime(x), prettytime(y), prettytime2((int(y) - int(x)) / 1000)]
for i in a:
for i in a:
复制
已复制
复制
已复制
f = file(i, 'r').read()
f = file(i, 'r').read()
carregando_tela_ligada = []
carregando_tela_ligada = []
carregando_tela_desligada = []
carregando_tela_desligada = []
descarregando_tela_ligada = []
descarregando_tela_ligada = []
descarregando_tela_desligada = []
descarregando_tela_desligada = []
carregando = estava_carregando(f)
carregando = estava_carregando(f)
tela = estava_ligado(f)
tela = estava_ligado(f)
last = None
last = None
last_percent = None
last_percent = None
复制
已复制
复制
已复制
n = 1
复制
已复制
复制
已复制
for h in f.splitlines():
for h in f.splitlines():
g, r = h.split(' - ')
g, r = h.split(' - ')
if g[0].isdigit():
if g[0].isdigit():
if
g != last_percent:
if debug3: print 'carregando =>', carregando
if
debug2: print 'tela ligada =>', tela
if last == None:
if last == None:
last = r
last = r
if carregando:
if carregando:
if tela:
if tela:
carregando_tela_ligada.append(process(
last, r,
last_percent
))
if debug: print '%d - Carregando o celular com a tela ligada, %s' % (n, h)
carregando_tela_ligada.append(process(
n,
last, r,
g
))
else:
else:
carregando_tela_desligada.append(process(
last, r,
last_percent
))
if debug: print '%d - Carregando o celular com a tela desligada, %s' % (n, h)
carregando_tela_desligada.append(process(
n,
last, r,
g
))
else:
else:
if tela:
if tela:
descarregando_tela_ligada.append(process(
last, r,
last_percent
))
if debug: print '%d - Descarregando o celular com a tela ligada, %s' % (n, h)
descarregando_tela_ligada.append(process(
n,
last, r,
g
))
else:
else:
descarregando_tela_desligada.append(process(
last, r,
last_percent
))
if debug: print '%d - Descarregando o celular com a tela desligada, %s' % (n, h)
descarregando_tela_desligada.append(process(
n,
last, r,
g
))
last = r
last = r
last_percent = g
n += 1
if g == "tela desligada":
if g == "tela desligada":
tela = False
tela = False
复制
已复制
复制
已复制
if debug2: print 'tela desligada'
复制
已复制
复制
已复制
if g == "tela ligada":
if g == "tela ligada":
tela = True
tela = True
复制
已复制
复制
已复制
if debug2: print 'tela ligada'
复制
已复制
复制
已复制
if g == "descarregando bateria":
if g == "descarregando bateria":
carregando = False
carregando = False
复制
已复制
复制
已复制
if debug3: print 'descarregando'
复制
已复制
复制
已复制
if g == "carregando bateria":
if g == "carregando bateria":
carregando = True
carregando = True
复制
已复制
复制
已复制
if debug3: print 'carregando lol'
复制
已复制
复制
已复制
复制
已复制
复制
已复制
if debug:
复制
已复制
复制
已复制
print "carregando_tela_ligada ="
print "carregando_tela_ligada ="
pprint.pprint(carregando_tela_ligada)
pprint.pprint(carregando_tela_ligada)
print "carregando_tela_desligada ="
print "carregando_tela_desligada ="
pprint.pprint(carregando_tela_desligada)
pprint.pprint(carregando_tela_desligada)
print "descarregando_tela_ligada ="
print "descarregando_tela_ligada ="
pprint.pprint(descarregando_tela_ligada)
pprint.pprint(descarregando_tela_ligada)
print "descarregando_tela_desligada ="
print "descarregando_tela_desligada ="
pprint.pprint(descarregando_tela_desligada)
pprint.pprint(descarregando_tela_desligada)
已保存差异
原始文本
打开文件
import glob, time, pprint a = glob.glob('*.txt')[:1] def postar_bonito(kk): l = [] x = kk.splitlines() for k in x: m, o = k.split(' - ') o = time.strftime('%d/%m/%Y - %H:%M:%S', time.localtime(int(o)/1000)) if m[0].isdigit(): m += '%' l.append('%s - %s' % (o, m)) return '\n'.join(l) def estava_ligado(x): m = f.index('tela desligada') mm = f.index('tela ligada') return mm > m def remover_repetidos(s): last = 'lolcopter' k = [] for i, e in enumerate(s): lolcopter = e.split(' - ')[0] if lolcopter != last: k.append(lolcopter) last = lolcopter return k def estava_carregando(j): lol = remover_repetidos([m for m in j.splitlines() if m[0].isdigit()]) return int(lol[0]) < int(lol[1]) def prettytime(x): return time.strftime('%d/%m/%Y - %H:%M:%S', time.localtime(int(x) / 1000)) def prettytime2(x): o, k = divmod(x, 60) return '%02d:%02d' % (o, k) def process(x, y, z): return [z, prettytime(x), prettytime(y), prettytime2((int(y) - int(x)) / 1000)] for i in a: f = file(i, 'r').read() carregando_tela_ligada = [] carregando_tela_desligada = [] descarregando_tela_ligada = [] descarregando_tela_desligada = [] carregando = estava_carregando(f) tela = estava_ligado(f) last = None last_percent = None for h in f.splitlines(): g, r = h.split(' - ') if g[0].isdigit(): if g != last_percent: if last == None: last = r if carregando: if tela: carregando_tela_ligada.append(process(last, r, last_percent)) else: carregando_tela_desligada.append(process(last, r, last_percent)) else: if tela: descarregando_tela_ligada.append(process(last, r, last_percent)) else: descarregando_tela_desligada.append(process(last, r, last_percent)) last = r last_percent = g if g == "tela desligada": tela = False if g == "tela ligada": tela = True if g == "descarregando bateria": carregando = False if g == "carregando bateria": carregando = True print "carregando_tela_ligada =" pprint.pprint(carregando_tela_ligada) print "carregando_tela_desligada =" pprint.pprint(carregando_tela_desligada) print "descarregando_tela_ligada =" pprint.pprint(descarregando_tela_ligada) print "descarregando_tela_desligada =" pprint.pprint(descarregando_tela_desligada)
更改后文本
打开文件
import glob, time, pprint a = glob.glob('*.txt')[:1] debug = True #tudo debug2 = False #tela debug3 = False #bateria def postar_bonito(kk): l = [] x = kk.splitlines() for k in x: m, o = k.split(' - ') o = time.strftime('%d/%m/%Y - %H:%M:%S', time.localtime(int(o)/1000)) if m[0].isdigit(): m += '%' l.append('%s - %s' % (o, m)) return '\n'.join(l) def estava_ligado(x): m = f.index('tela desligada') mm = f.index('tela ligada') return mm > m def remover_repetidos(s): last = 'lolcopter' k = [] for i, e in enumerate(s): lolcopter = e.split(' - ')[0] if lolcopter != last: k.append(lolcopter) last = lolcopter return k def estava_carregando(j): lol = remover_repetidos([m for m in j.splitlines() if m[0].isdigit()]) return int(lol[0]) < int(lol[1]) def prettytime(x): return time.strftime('%d/%m/%Y - %H:%M:%S', time.localtime(int(x) / 1000)) def prettytime2(x): o, k = divmod(x, 60) return '%02d:%02d' % (o, k) def process(n, x, y, z): return [n, z, prettytime(x), prettytime(y), prettytime2((int(y) - int(x)) / 1000)] for i in a: f = file(i, 'r').read() carregando_tela_ligada = [] carregando_tela_desligada = [] descarregando_tela_ligada = [] descarregando_tela_desligada = [] carregando = estava_carregando(f) tela = estava_ligado(f) last = None last_percent = None n = 1 for h in f.splitlines(): g, r = h.split(' - ') if g[0].isdigit(): if debug3: print 'carregando =>', carregando if debug2: print 'tela ligada =>', tela if last == None: last = r if carregando: if tela: if debug: print '%d - Carregando o celular com a tela ligada, %s' % (n, h) carregando_tela_ligada.append(process(n, last, r, g)) else: if debug: print '%d - Carregando o celular com a tela desligada, %s' % (n, h) carregando_tela_desligada.append(process(n, last, r, g)) else: if tela: if debug: print '%d - Descarregando o celular com a tela ligada, %s' % (n, h) descarregando_tela_ligada.append(process(n, last, r, g)) else: if debug: print '%d - Descarregando o celular com a tela desligada, %s' % (n, h) descarregando_tela_desligada.append(process(n, last, r, g)) last = r n += 1 if g == "tela desligada": tela = False if debug2: print 'tela desligada' if g == "tela ligada": tela = True if debug2: print 'tela ligada' if g == "descarregando bateria": carregando = False if debug3: print 'descarregando' if g == "carregando bateria": carregando = True if debug3: print 'carregando lol' if debug: print "carregando_tela_ligada =" pprint.pprint(carregando_tela_ligada) print "carregando_tela_desligada =" pprint.pprint(carregando_tela_desligada) print "descarregando_tela_ligada =" pprint.pprint(descarregando_tela_ligada) print "descarregando_tela_desligada =" pprint.pprint(descarregando_tela_desligada)
查找差异