![](/img/trans.png)
[英]How can I iterate over files in a folder to move each file with specific extension
[英]How do I iterate over a list of links onto multiple files with a specific range on each file?
我試圖遍歷鏈接列表,並希望將其按順序分為幾個文件。 這就是輪廓的外觀。
根文件(第一個文件)將包含范圍為1-101的鏈接。
然后, 第二級文件(文件2-10)將包含范圍為101-1101的鏈接(每個文件10個鏈接)。
例如 102-111 are links on file 2, 112-121 are links on file 3, 122-131 are links on file 4, etc.
我如何做到這一點,以便可以在第二層上以正確的索引位置遍歷每個文件10個鏈接?
獲取所有文件的列表並進行遍歷
import os
listOfFiles = os.listdir("./") # "./" path to folader with files
for file in listOfFiles:
# do what y want with file
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.