Noob problem with read()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Guy_in_Wisconsin
    New Member
    • Sep 2005
    • 2

    #1

    Noob problem with read()

    Hello. I'm trying out Python after being a novice Perl user. I'm having an unexpected result when I run this script:

    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" 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.
  • Guy_in_Wisconsin
    New Member
    • Sep 2005
    • 2

    #2
    ***bump***

    Comment

    Working...