listdir

Smith smith at smith.com
Mon Sep 5 11:41:41 EDT 2016


Il 05/09/2016 17:34, Rustom Mody ha scritto:
> So what do you get when you replace the if-else with a simple: print(file)

a = input("search for files with the extension .py into directory:  ")
     for file in os.listdir(a):
         if file.endswith(".py"):
             print(file)


search for files with the extension .py into directory:  /home/
filepy.py
tempo.py
filescript.py
ticker.py
toolgen.py
words.py
m.py
scrapingweb.py
partitesnai.py
pythonprova.py
scraper.py
snmp.py
printreturn.py
multiping.py
scraping.py
funzionipython.py





More information about the Python-list mailing list