python 3.x - How to check the part of file name in python3? -


for example

if have files:

applepie.txt applejam.txt applesauce.txt beercan.txt beercup.txt 

and want download apple.txt, boar.txt, , cat.txt on internet.

here's point.

if not os.path.isfile(apple.txt)     urlretrieve(apple.txt) 

is not work, of course. there not apple.txt.

but exist applepie, jam, sauce.

so don't want download apple, boar, cat.

how can check of apple files, , pass download.

you can use os.listdir() or glob module. listdir easier use should start that.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - How can I echo out this array? -

javascript - IE11 incompatibility with jQuery's 'readonly'? -