Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
more looping help?
#8
Or you can use several names in the loop. Two examples:

for number, key, value in enumerate(my_dictionary.items(), 1):
    print(number, key, value)
for _ , _ , files in os.walk(path):
    print(files)
os.walk walks through a directory tree and return a current directory, directories list and the files list in that directory or subdirectory in the path in that order. In this case, I do not care about the directory/subdirectory it walks through either the directory list. I want just the to know the files so I use underscore for the first two names and ignore them.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
more looping help? - by pcsailor - Oct-01-2018, 04:32 AM
RE: more looping help? - by buran - Oct-01-2018, 06:45 AM
RE: more looping help? - by pcsailor - Oct-01-2018, 09:15 AM
RE: more looping help? - by buran - Oct-01-2018, 10:20 AM
RE: more looping help? - by stullis - Oct-02-2018, 12:05 AM
RE: more looping help? - by pcsailor - Oct-03-2018, 05:05 AM
RE: more looping help? - by buran - Oct-03-2018, 06:04 AM
RE: more looping help? - by wavic - Oct-03-2018, 06:22 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020