-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomparaficheroweb.py
74 lines (49 loc) · 1.38 KB
/
comparaficheroweb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import urllib2
# google cada vez que generas la web pone codigo diferente por el caracter 258
#url = 'http://www.google.es'
url = 'https://sourceforge.net/projects/zorin-os/files/15/'
#fichero = './datos/googlecom.txt'
fichero = './datos/zorin.txt'
response = urllib2.urlopen(url)
webContent = response.read()
webDatos = webContent[0:10000000]
file1 = open(fichero, 'r')
fileContent = file1.read()
file1.close()
print ("COMPARACION 0")
if fileContent == webDatos:
print ("Comp 0 - iguales")
else:
print ("Comp 0 - diferente")
print ("COMPARACION 1")
if fileContent == webContent:
print ("Comp 1 - iguales")
else:
print ("Comp 1 - diferente")
print ("COMPARACION 2")
i=0
for cfile in fileContent:
i=i+1
cweb = webDatos[i-1:i]
if cfile != cweb:
print ("Comp 2 - diferente")
print (i)
print (cfile + " - " + cweb)
#exit()
if i==130008: exit()
#print(webContent[0:10000000])
#contenido = webContent[0:10000000]
#print(contenido)
#with open('./datos/diffgoogle.txt', 'w') as file_out:
# for line in difference:
# file_out.write(line)
#file1 = open('some_file_1.txt', 'r')
#file2 = open('some_file_2.txt', 'r')
#FO = open('some_output_file.txt', 'w')
#for line1 in file1:
# for line2 in file2:
# if line1 == line2:
# FO.write("%s\n" %(line1))
#FO.close()
#file1.close()
#file2.close()