Answer the question
In order to leave comments, you need to log in
Python. How to create a list with 100 lines?
Good afternoon!
Tell me how to create a list of 100 lines?
import os
dest = 'O:\\OPO\\PFR\\'
filelist = open('filelist.lst', 'w')
os.chdir(dest)
for root, dirs, files in os.walk("."):
for filenames in files:
if filenames.endswith(".xml"):
filelist.write(dest + filenames + '\n')
filelist.close()
Answer the question
In order to leave comments, you need to log in
It can be like this:
or like this:
for filenames in files[0:100]:
for filenames in files[:100]:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question