-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiff.py
More file actions
50 lines (41 loc) · 1 KB
/
diff.py
File metadata and controls
50 lines (41 loc) · 1 KB
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
def diff_default(file1, file2):
def trans(s):
s = list(map(lambda s: s.rstrip(), s.split('\n')))
if s[-1] == '':
s = s[:-1]
return s
with open(file1) as f:
f1 = trans(f.read())
with open(file2) as f:
f2 = trans(f.read())
return f1 != f2
def _584A(file1, file2, file3):
def trans(s):
s = list(map(lambda s: s.rstrip(), s.split('\n')))
if s[-1] == '':
s = s[:-1]
return s
with open(file1) as f:
f1 = trans(f.read())
with open(file2) as f:
f2 = trans(f.read())
if not len(f1) == 1:
return True
f1 = f1[0]
f2 = f2[0]
if int(f2) == -1:
return f1 != f2
with open(file3) as f:
line = f.readline()
n, t = map(int, line.split())
if not f1.isdigit():
return True
if len(f1) != n:
return True
if f1[0] == '0':
return True
s1 = int(f1)
if s1 % t == 0:
return False
else:
return True