| | |
Identifying file types in python
![]() |
folders are easy to identify, use the function
look if functions in
Also for common path operations, there is a nice Path class which exists at python.org. It was rejected as a standard class in python, but it can be useful. Look here http://www.python.org/dev/peps/pep-0355/. It's impelmented here http://wiki.python.org/moin/PathModule.
os.path.isdir() .look if functions in
os.path suffice to your needs 
Also for common path operations, there is a nice Path class which exists at python.org. It was rejected as a standard class in python, but it can be useful. Look here http://www.python.org/dev/peps/pep-0355/. It's impelmented here http://wiki.python.org/moin/PathModule.
Last edited by Gribouillis; Aug 17th, 2008 at 12:55 pm.
•
•
Join Date: May 2008
Posts: 39
Reputation:
Solved Threads: 7
python Syntax (Toggle Plain Text)
filerz = "c:\\cookie\\win\\etc\\beeeeeeepyyrasdf.doom" def filetype(file): return file.split(".")[-1] print filetype(filerz) >> doom
![]() |
Other Threads in the Python Forum
- Previous Thread: Recursive functions - please help!
- Next Thread: Opening pipelines with python ?
| Thread Tools | Search this Thread |
address aliased anydbm bash beginner bits calling casino changecolor class clear conversion convert corners count cturtle cursor curves definedlines dictionary digital dynamic dynamically events examples excel external file float format frange function gui handling hints homework i/o iframe import info input java line linux list lists loan loop matching mouse multiple number numbers output parsing path port prime programming projects py py2exe pygame python random rational raw_input recursion recursive scrolledtext searchingfile shebang signal singleton string strings subprocess table tails terminal text thread threading time tkinter tlapse tooltip tuple tutorial type ubuntu unicode urllib urllib2 valueerror variable web-scrape whileloop word wxpython





