We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 97efc1c + 4e7c686 commit 1a629dfCopy full SHA for 1a629df
py/_path/common.py
@@ -170,11 +170,16 @@ def read(self, mode='r'):
170
def readlines(self, cr=1):
171
""" read and return a list of lines from the path. if cr is False, the
172
newline will be removed from the end of each line. """
173
+ if sys.version_info < (3, ):
174
+ mode = 'rU'
175
+ else: # python 3 deprecates mode "U" in favor of "newline" option
176
+ mode = 'r'
177
+
178
if not cr:
- content = self.read('rU')
179
+ content = self.read(mode)
180
return content.split('\n')
181
else:
- f = self.open('rU')
182
+ f = self.open(mode)
183
try:
184
return f.readlines()
185
finally:
0 commit comments