LINUX.ORG.RU

История изменений

Исправление tz4678, (текущая версия) :

#!/usr/bin/env python
"""
sudo ./pydocopy /dev/sda1 /dev/sda2
"""
import sys

with open(sys.argv[1], 'rb') as r:
  with open(sys.argv[2], 'wb') as w:
    while (data := r.read(4096)) != b'':
      w.write(data)
      w.flush()

Исходная версия tz4678, :

#!/usr/bin/env python
"""
sudo ./pydocopy /dev/sda1 /dev/sda2
"""
import sys

with open(sys.argv[1], 'rb') as r:
  with open(sys.argv[2], 'wb') as w:
    while (data := r.read(4096)) != b'':
      w.write(data)