python 3.x - print() inside a for loop not working -


im trying read ".xlsx" files in folder script is, when try print file names in organized form (inside loop), doesn't work... however, when run script python idle, works...

see pictures (from idle / openning ".py" file): running python idle

running python file


see code below:

# !/usr/bin/python import time, os  avaliable_xlsx = list(os.popen('dir /b /a-d *.xlsx').read().splitlines()) item in avaliable_xlsx:     print('{}- {}   '.format((avaliable_xlsx.index(item)+1), item), end='')  #"print (avaliable_xlsx)" works!, that's not i'm trying do.  time.sleep(20) 


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -