Browse Source

make it pep8 compliant

master
T. Meissner 10 years ago
parent
commit
47dd9bf1cc
1 changed files with 2 additions and 3 deletions
  1. +2
    -3
      python_3_oop/chapter05/zipreplace_comp.py

+ 2
- 3
python_3_oop/chapter05/zipreplace_comp.py View File

@ -3,7 +3,6 @@ import sys
import os import os
class ZipReplace: class ZipReplace:
def __init__(self, search_string, replace_string): def __init__(self, search_string, replace_string):
@ -11,12 +10,12 @@ class ZipReplace:
self.replace_string = replace_string self.replace_string = replace_string
def process(self, zipprocessor): def process(self, zipprocessor):
"perform a search and replace on all files in the temporary directory"
"""perform a search and replace on all files in the temporary directory"""
for filename in os.listdir(zipprocessor.temp_directory): for filename in os.listdir(zipprocessor.temp_directory):
with open(zipprocessor._full_filename(filename)) as file: with open(zipprocessor._full_filename(filename)) as file:
contents = file.read() contents = file.read()
contents = contents.replace(self.search_string, contents = contents.replace(self.search_string,
self.replace_string)
self.replace_string)
with open(zipprocessor._full_filename(filename), "w") as file: with open(zipprocessor._full_filename(filename), "w") as file:
file.write(contents) file.write(contents)


Loading…
Cancel
Save