Strip whitespaces added by decode() function
This commit is contained in:
parent
00c4b090c1
commit
936ea9302a
1 changed files with 3 additions and 2 deletions
|
@ -97,8 +97,9 @@ class FileWrapper(io.FileIO):
|
||||||
line = parent.next() # Python 2
|
line = parent.next() # Python 2
|
||||||
if line:
|
if line:
|
||||||
self.line_no += 1
|
self.line_no += 1
|
||||||
# Convert byte array to string with correct encoding
|
# Convert byte array to string with correct encoding and
|
||||||
return line.decode(sys.getdefaultencoding())
|
# strip any whitespaces added in the decoding process.
|
||||||
|
return line.decode(sys.getdefaultencoding()).strip() + "\n"
|
||||||
return None
|
return None
|
||||||
next = __next__
|
next = __next__
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue