This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
pastas = os.listdir() | |
total = 0 | |
arq = open("lista_de_arquivos.txt", "w",encoding="utf-8") | |
def listar_pasta(pasta): | |
tot = 0 | |
subpastas = list() | |
if os.path.isdir(pasta): | |
items = os.listdir(pasta) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
# exemplo alterado de EX_10.5.py para 10_5.py | |
for nome in os.listdir('./arquivos'): | |
# alterar conforme sua necessidade de geração de nomes e layout de arquivos | |
dados = str(nome).split(".") | |
numero = dados[0].split("_")[1] | |
subnumero = dados[1] | |
novo_nome = numero + "_" + subnumero + ".py" | |
NewerOlder