Re: simple error i hope

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Clay Hobbs

    Re: simple error i hope


    On Fri, 2008-08-01 at 13:25 -0700, Emile van Sebille wrote:
    suhail shaik wrote:
    >
    print fileName
    file = fileName.split( ".")
    ......^^^^ this is a list
    >
    you're shadowing a builtin -- generally a bad practice
    >
    print file
    textfile = file[0]+".txt"
    print textfile
    os.chdir(PNAME)
    file(textfile,' wt')
    >
    ......^^^^ and this is why
    >
    >
    HTH,
    >
    Emile
    >
    It is also a good idea to open files with the open() function and not the
    file() function. They do the exact same thing, and take the exact same
    parameters, just open() makes your code a bit more readable (or at least
    that's what I think).

    --Ratfink

Working...