text: 0
  How do you make Python distinguish from files and folders if they are dragged and dropped into the program's window?
  import os import string newDrag = raw_input("Drag and drop the file or folder you want to add.\n") newStrip = newDrag.strip('"') #Removes the quotes Windows randomly adds for some reason if string.find(newStrip, "."): #Checks for the period that precedes the file extension print "That is a file." else: #There is no period, no file extension, it is a folder. print "That is a folder." os.system("pause")
  I drop a new folder from Program Files into the program and...
  Drag and drop the file or folder you want to add.
  C:\Program Files\New Folder
  That is a file.
  Why doesn't this work right? It still prints "That is a file." even if nothing is typed in. It's just skipping the else: for some reason.