Hello. I'm trying out Python after being a novice Perl user. I'm having an unexpected result when I run this script:
"x" contain the data of the script, "test.py", and not "one.bin".
"x = f.read()" is somehow reading the contents of the source script, and I'm not sure why, unless I'm totally missing something obvious to expert Python users.
Thanks.
Code:
# test.py
f = open("one.bin",'rb')
n = open("two.bin",'wb')
x = f.read(n)
n.write(x)
f.close()
n.close()
"x = f.read()" is somehow reading the contents of the source script, and I'm not sure why, unless I'm totally missing something obvious to expert Python users.
Thanks.
Comment