|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Quick Tip?
My brain seems to not be working today, so I thought I would ask for a little help. I have this program that searches for folders with certain names, but a problem occured when it found an xls document with the same name as the folders it was looking for. I realize I could just rename the xls document, but I would rather have the code omit files. Is there a way to do this, or have it so it only looks at folders and not files?
|
|
#2
|
||||
|
||||
|
There are functions in the os module to help make those decisions. That assumes it is Python you are talking about.
__________________
*** Experimental Python Markup CGI V2 *** |
|
#3
|
|||
|
|||
|
Quote:
Yes, it is Python. Sorry I didnt mention (remember brain not working comment? haha) I am a pure newbie so, I'm trying to figure out what you mean by "in the os module"... |
|
#4
|
||||
|
||||
|
The functions i think Grim was getting at is called os.path.isdir() which you can find in the os.path documentation - along with some others which you can also use to check if the path is this or that.
Just because your brain isn't working today here it is .http://www.python.org/doc/2.3.4/lib/module-os.path.html Hope this helps, Mark. |
|
#5
|
|||
|
|||
|
Thanks alot guys, it works!
|
|
#6
|
||||
|
||||
|
No problem at all. You might also want to take a few seconds to look over the stick at the top of this forum conserning how to ask a question
.Mark. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Quick Tip? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|