Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2c6d799

Browse files
committed
Simplify PdfFileSplitter challenge solution by removing calls to str()
1 parentabf7be6 commit2c6d799

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎ch13-interact-with-pdf-files/3-challenge-PdfFileSplitter-class.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class PdfFileSplitter:
1111

1212
def__init__(self,pdf_path):
1313
# Open the PDF file with a new PdfFileReader instance
14-
self.pdf_reader=PdfFileReader(str(pdf_path))
14+
self.pdf_reader=PdfFileReader(pdf_path)
1515
# Initialize the .writer1 and .writer2 attributes to None
1616
self.writer1=None
1717
self.writer2=None
@@ -32,10 +32,10 @@ def split(self, breakpoint):
3232
defwrite(self,filename):
3333
"""Write both PdfFileWriter instances to files"""
3434
# Write the first file to <filename>_1.pdf
35-
withPath(str(filename)+"_1.pdf").open(mode="wb")asoutput_file:
35+
withPath(filename+"_1.pdf").open(mode="wb")asoutput_file:
3636
self.writer1.write(output_file)
3737
# Write the second file to <filename>_2.pdf
38-
withPath(str(filename)+"_2.pdf").open(mode="wb")asoutput_file:
38+
withPath(filename+"_2.pdf").open(mode="wb")asoutput_file:
3939
self.writer2.write(output_file)
4040

4141

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp