What's Up?
So anyway, If you wanted to cd or open certain files with a certain type of extension in cmd, You would use the star or wildcard key (*), But I'm fairly sure python doesn't use them (Well actually fully sure) So the folder I'm trying to change directory too "os.chdir('C:\menolikewindow')", Changes it's name from computer to computer, How could I find out the name and cd into there?
Thanks Bye
Wildcards In os.chdir
Started by Syphilis, Jun 06 2010 03:49 PM
1 reply to this topic
#1
Posted 06 June 2010 - 03:49 PM
|
|
|
#2
Posted 15 June 2010 - 02:24 PM
use os.listdir
then figure out which are directories by calling os.path.isdir, out of the ones you have selected(like [i for i in os.listdir("./") if "menolikewindow" in i])
>>> import os
>>> os.listdir("./")
['My Documents','syphilis infections','pron with marblecake','also the game']
then figure out which are directories by calling os.path.isdir, out of the ones you have selected(like [i for i in os.listdir("./") if "menolikewindow" in i])


Sign In
Create Account

Back to top









