Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Untitled diff
Created
10 years ago
Diff never expires
Clear
Export
Share
Explain
75 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
90 lines
Copy
99 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
105 lines
Copy
import glob, time, pprint
import glob, time, pprint
a = glob.glob('*.txt')[:1]
a = glob.glob('*.txt')[:1]
Copy
Copied
Copy
Copied
debug = True #tudo
debug2 = False #tela
debug3 = False #bateria
def postar_bonito(kk):
def postar_bonito(kk):
Copy
Copied
Copy
Copied
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):
Copy
Copied
Copy
Copied
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):
Copy
Copied
Copy
Copied
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):
Copy
Copied
Copy
Copied
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):
Copy
Copied
Copy
Copied
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):
Copy
Copied
Copy
Copied
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:
Copy
Copied
Copy
Copied
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
for h in f.splitlines():
n = 1
g, r = h.split(' - ')
for h in f.splitlines():
g, r = h.split(' - ')
if g[0].isdigit():
if g != last_percent:
if g[0].isdigit():
if last == None:
if debug3: print 'carregando =>', carregando
last = r
if debug2: print 'tela ligada =>', tela
if carregando:
if last == None:
if tela:
last = r
carregando_tela_ligada.append(process(
last, r,
last_percent
))
if carregando:
else:
if tela:
carregando_tela_desligada.append(process(
last, r,
last_percent
))
if debug: print '%d - Carregando o celular com a tela ligada, %s' % (n, h)
else:
carregando_tela_ligada.append(process(
n,
last, r,
g
))
if tela:
else:
descarregando_tela_ligada.append(process(
last, r,
last_percent
))
if debug: print '%d - Carregando o celular com a tela desligada, %s' % (n, h)
else:
carregando_tela_desligada.append(process(
n,
last, r,
g
))
descarregando_tela_desligada.append(process(
last, r,
last_percent
))
else:
last = r
if tela:
last_percent = g
if debug: print '%d - Descarregando o celular com a tela ligada, %s' % (n, h)
descarregando_tela_ligada.append(process(
n,
last, r,
g
))
if g == "tela desligada":
else:
tela = False
if debug: print '%d - Descarregando o celular com a tela desligada, %s' % (n, h)
if g == "tela ligada":
descarregando_tela_desligada.append(process(
n,
last, r,
g
))
tela = True
last = r
if g == "descarregando bateria":
n += 1
carregando = False
if g == "carregando bateria":
if g == "tela desligada":
carregando = True
tela = False
if debug2: print 'tela desligada'
print "carregando_tela_ligada ="
if g == "tela ligada":
pprint.pprint(carregando_tela_ligada)
tela = True
print "carregando_tela_desligada ="
if debug2: print 'tela ligada'
pprint.pprint(carregando_tela_desligada)
if g == "descarregando bateria":
print "descarregando_tela_ligada ="
carregando = False
pprint.pprint(descarregando_tela_ligada)
if debug3: print 'descarregando'
print "descarregando_tela_desligada ="
if g == "carregando bateria":
pprint.pprint(descarregando_tela_desligada)
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)
Saved diffs
Original text
Open file
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)
Changed text
Open file
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)
Find difference