Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Éditeur live
Cacher identiques
Sans retour à la ligne
Vue
Divisé
Unifié
Niveau de précision
Intelligent
Mot
Caractère
Coloration syntaxique
Choisir la syntaxe
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
Untitled diff
Créé
il y a 10 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
75 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
90 lignes
Copier tout
99 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
105 lignes
Copier tout
import glob, time, pprint
import glob, time, pprint
a = glob.glob('*.txt')[:1]
a = glob.glob('*.txt')[:1]
Copier
Copié
Copier
Copié
debug = True #tudo
debug2 = False #tela
debug3 = False #bateria
def postar_bonito(kk):
def postar_bonito(kk):
Copier
Copié
Copier
Copié
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):
Copier
Copié
Copier
Copié
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):
Copier
Copié
Copier
Copié
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):
Copier
Copié
Copier
Copié
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):
Copier
Copié
Copier
Copié
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):
Copier
Copié
Copier
Copié
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:
Copier
Copié
Copier
Copié
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)
Différences enregistrées
Texte d'origine
Ouvrir un fichier
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)
Texte modifié
Ouvrir un fichier
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)
Trouver la différence