Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee5e61d

Browse files
String method conversion.
1 parent 6b71e74 commit ee5e61d

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

Lib/gzip.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# based on Andrew Kuchling's minigzip.py distributed with the zlib module
77

8-
import string, struct, sys, time
8+
import struct, sys, time
99
import zlib
1010
import __builtin__
1111

@@ -138,7 +138,7 @@ def write(self,data):
138138
self.fileobj.write( self.compress.compress(data) )
139139

140140
def writelines(self,lines):
141-
self.write(string.join(lines))
141+
self.write(" ".join(lines))
142142

143143
def read(self, size=-1):
144144
if self.extrasize <= 0 and self.fileobj is None:
@@ -281,10 +281,10 @@ def readline(self, size=-1):
281281
readsize = min(100, size) # Read from the file in small chunks
282282
while 1:
283283
if size == 0:
284-
return string.join(bufs, '') # Return resulting line
284+
return "".join(bufs) # Return resulting line
285285

286286
c = self.read(readsize)
287-
i = string.find(c, '\n')
287+
i = c.find('\n')
288288
if size is not None:
289289
# We set i=size to break out of the loop under two
290290
# conditions: 1) there's no newline, and the chunk is
@@ -296,7 +296,7 @@ def readline(self, size=-1):
296296
if i >= 0 or c == '':
297297
bufs.append(c[:i+1]) # Add portion of last chunk
298298
self._unread(c[i+1:]) # Push back rest of chunk
299-
return string.join(bufs, '') # Return resulting line
299+
return ''.join(bufs) # Return resulting line
300300

301301
# Append chunk to list, decrease 'size',
302302
bufs.append(c)

Lib/keyword.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
iskeyword = kwdict.has_key
5353

5454
def main():
55-
import sys, re, string
55+
import sys, re
5656

5757
args = sys.argv[1:]
5858
iptfile = args and args[0] or "Python/graminit.c"
@@ -66,7 +66,7 @@ def main():
6666
while 1:
6767
line = fp.readline()
6868
if not line: break
69-
if string.find(line, '{1, "') > -1:
69+
if line.find('{1, "') > -1:
7070
match = strprog.search(line)
7171
if match:
7272
lines.append(" '" + match.group(1) + "',\n")
@@ -89,7 +89,7 @@ def main():
8989

9090
# write the output file
9191
fp = open(optfile, 'w')
92-
fp.write(string.join(format, ''))
92+
fp.write(''.join(format))
9393
fp.close()
9494

9595
if __name__ == "__main__":

0 commit comments

Comments
 (0)