Web Analytics Made Easy -
StatCounter this is not a file name..or is it --> - CodingForum

Announcement

Collapse
No announcement yet.

this is not a file name..or is it -->

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • this is not a file name..or is it -->

    this python string:

    f=open('/tmp/workfile', 'w')

    my tutorial says that this string contains a file name. Well, where is the file name?. File names have extensions like .exe or .txt.

    workfile does not have an extension so even if it was a file there could be more than one workfile. Like a workfile.txt and a workfile.exe...

    workfile could also be a directory..I'm confused. also what is /temp?

  • #2
    File names have extensions like .exe or .txt.
    Nope, files can be present without any "extension" at all.

    If you wanted to make sure that pointed to a directory you'd need to end it with another /.
    Check out the Forum Search. It's the short path to getting great results from this forum.

    Comment


    • #3
      what if there are two of the same file name?..you would need to know the extension to tell them apart.

      Comment


      • #4
        Originally posted by velious
        what if there are two of the same file name?..you would need to know the extension to tell them apart.
        Nope, in order for there to be two with the same name they'd have to be in different directories. Names are always unique within a single directory (name includes all extensions).
        Check out the Forum Search. It's the short path to getting great results from this forum.

        Comment


        • #5
          windows is usually very iritating when you try to remove extensions from files. well it is for my win98 why would you want an extensionless file in this example anyways?
          photoshop too expensive? use the GIMP! www.gimp.org

          Comment


          • #6
            whackaxe
            that was the code i copied from an example.

            Comment

            Working...
            X