-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path20170327.py
More file actions
34 lines (24 loc) · 707 Bytes
/
20170327.py
File metadata and controls
34 lines (24 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
import os
#DIR=os.getcwd()
os.chdir('c:/python_test/test/')
DIR=os.getcwd()
FILE=os.path.join(DIR,'Your Electronic Ticket Receipt_yixuan.pdf')
#with open(FILE,'r') as file:
# size_to_read=5
# file_content=file.read(size_to_read)
# while len(file_content) >0:
# print(file_content,end="")
# file_content=file.read(size_to_read)
with open(FILE,'rb') as file:
with open ('recipt_copy.pdf','wb') as file2:
size_of_chunk=4096
file_content=file.read(size_of_chunk)
while len(file_content) >0:
file2.write(file_content)
file_content=file.read(size_of_chunk)
# read=file.readlines()
# for line in read:
# print(line,end="")
# for line in file:
# print (line,end='')