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

angular - DownloadURL return null in below code -

python 2.7 - Given three nested dictionaries, sort the top two nested dictionaries from a value in the innermost dictionary? -