copy-bin.py 394 B

12345678910111213141516
  1. #!/usr/bin/env python3
  2. # Copyright 2009-2017 BHG http://bw.org/
  3. def main():
  4. infile = open('berlin.jpg', 'rb')
  5. outfile = open('berlin-copy.jpg', 'wb')
  6. while True:
  7. buf = infile.read(10240)
  8. if buf:
  9. outfile.write(buf)
  10. print('.', end='', flush=True)
  11. else: break
  12. outfile.close()
  13. print('\ndone.')
  14. if __name__ == '__main__': main()