Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
text_diff.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# Copyright 2015 The PDFium Authors
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6import difflib
7import sys
8
9
10def main(argv):
11 if len(argv) != 3:
12 print('%s: invalid arguments' % argv[0])
13 return 2
14 filename1 = argv[1]
15 filename2 = argv[2]
16 try:
17 with open(filename1, "r") as f1:
18 str1 = f1.readlines()
19 with open(filename2, "r") as f2:
20 str2 = f2.readlines()
21 diffs = difflib.unified_diff(
22 str1, str2, fromfile=filename1, tofile=filename2)
23 except Exception as e:
24 print("something went astray: %s" % e)
25 return 1
26 status_code = 0
27 for diff in diffs:
28 sys.stdout.write(diff)
29 status_code = 1
30 return status_code
31
32
33if __name__ == '__main__':
34 sys.exit(main(sys.argv))
int main()
[0]
QDebug print(QDebug debug, QSslError::SslError error)
file open(QIODevice::ReadOnly)