text and binary files
This commit is contained in:
parent
ebbcf76b9e
commit
b0f113fa67
1
python-temel/binary.dat
Normal file
1
python-temel/binary.dat
Normal file
|
@ -0,0 +1 @@
|
|||
|
9
python-temel/binary.rb.wb.py
Normal file
9
python-temel/binary.rb.wb.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
def copy_file(source_path, dest_path):
|
||||
with open(source_path, 'rb') as fs:
|
||||
with open(dest_path, 'wb') as fd:
|
||||
while True:
|
||||
b = fs.read(4096)
|
||||
if not b:
|
||||
break
|
||||
fd.write(b)
|
||||
copy_file('sample.py', 'test.txt')
|
8
python-temel/binary.rb.wb.py~
Normal file
8
python-temel/binary.rb.wb.py~
Normal file
|
@ -0,0 +1,8 @@
|
|||
def copy_file(source_path, dest_path):
|
||||
with open(source_path, 'rb') as fs:
|
||||
with open(dest_path, 'wb') as fd:
|
||||
while True:
|
||||
b = fs.read(4096)
|
||||
if not b:
|
||||
break
|
||||
fd.write(b)
|
4
python-temel/bytes.wb.py
Normal file
4
python-temel/bytes.wb.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
s = 'ağrı dağı çok yüksek'
|
||||
with open('test.dat', 'wb') as f:
|
||||
b = bytes(s, encoding='utf-8')
|
||||
f.write(b)
|
4
python-temel/f.read.b.py
Normal file
4
python-temel/f.read.b.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
with open('test.txt', 'r+b') as f:
|
||||
b = f.read(10)
|
||||
print(b)
|
||||
|
2
python-temel/f.write.b.py
Normal file
2
python-temel/f.write.b.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
with open('binary.dat', 'wb') as f:
|
||||
f.write(b'\x10\x12\x13')
|
1
python-temel/test.dat
Normal file
1
python-temel/test.dat
Normal file
|
@ -0,0 +1 @@
|
|||
ağrı dağı çok yüksek
|
|
@ -1,2 +1,4 @@
|
|||
0123456789
|
||||
xxx
|
||||
a = 10
|
||||
b = 20
|
||||
c = a + b
|
||||
print(c)
|
||||
|
|
Loading…
Reference in New Issue
Block a user