mirror of https://gitee.com/openkylin/libvirt.git
python3: Open files in text instead of binary mode
We use text operations on the contents after reading them. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
e379dcce57
commit
b98d4244c6
|
@ -1327,7 +1327,7 @@ def open_and_print(filename):
|
||||||
else:
|
else:
|
||||||
print(" GEN " + filename)
|
print(" GEN " + filename)
|
||||||
|
|
||||||
return open(filename, "wb")
|
return open(filename, "wt")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1435,7 +1435,7 @@ block = None
|
||||||
|
|
||||||
|
|
||||||
# parse input file
|
# parse input file
|
||||||
for line in file(input_filename, "rb").readlines():
|
for line in open(input_filename, "rt").readlines():
|
||||||
number += 1
|
number += 1
|
||||||
|
|
||||||
if "#" in line:
|
if "#" in line:
|
||||||
|
|
|
@ -396,7 +396,7 @@ def open_and_print(filename):
|
||||||
else:
|
else:
|
||||||
print(" GEN " + filename)
|
print(" GEN " + filename)
|
||||||
|
|
||||||
return open(filename, "wb")
|
return open(filename, "wt")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ def main():
|
||||||
number = 0
|
number = 0
|
||||||
block = None
|
block = None
|
||||||
|
|
||||||
for line in file(input_filename, "rb").readlines():
|
for line in open(input_filename, "rt").readlines():
|
||||||
number += 1
|
number += 1
|
||||||
|
|
||||||
if "#" in line:
|
if "#" in line:
|
||||||
|
|
Loading…
Reference in New Issue