Hi,
Am 18.08.24 um 16:44 schrieb Stefan Ram:
Das "Python-Programm des Tages" erscheint für Diskussionszwecke,
Dann vermute ich mal, Du willst Diskussionsbeiträge :-)
with open( src_path, 'rb' )as src_file:
Ist zwar syntaktisch korrekt, aber bei ")as" drehen sich mir die
Zehnnägel hoch. Bitte mach ein Leerzeichen hinter die schließende Klammer.
def compare( src_path, dest_path ):
print( "comparing ..." )
with open( src_path, 'rb' )as f1, open( dest_path, 'rb')as f2:
while True:
chunk1 = f1.read( 4096 )
chunk2 = f2.read( 4096 )
if chunk1 != chunk2: return 1
if not chunk1: break
return 0
Sollte besser True (bei Erfolg) und False (bei Fehler) zurückgeben.
product = copy_and_compare\
( r"C:\example\from.txt",
r"C:\example\to.txt" )
Hint: Die öffnende Klammer hinter "copy_and_compare" und Du kannst Dir
den Backslash sparen.
--
Regards
Hartmut Goebel
| Hartmut Goebel |[email protected] |
|www.crazy-compilers.com | compilers which you thought are impossible |
_______________________________________________
python-de Mailingliste -- [email protected]
Zur Abmeldung von dieser Mailingliste senden Sie eine Nachricht an
[email protected]
https://mail.python.org/mailman3/lists/python-de.python.org/
Mitgliedsadresse: [email protected]