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

string - Using python and postgres, variables within execute function? -

android - How to get the Uri path from a ImageView? -