Untitled
unknown
plain_text
a year ago
563 B
11
Indexable
# 🥇 DESAFIO Manipulação de Arquivos 🥇 qtd_files = int(input('Quantos arquivos deseja criar? ')) file_name = input('Qual o nome dos arquivos? ') file_type = ['.txt', '.csv', '.json', '.xml'] for file in file_type: for i in range(qtd_files): if not os.path.exists(f'C:\\Users\\gabri\\PythonAutodidata\\Colecoes\\{file_name}_{i}{file}'): with open(f'{file_name}_{i}{file}', 'w', encoding='utf-8', newline='') as arquivo: pass else: print(f'Arquivo do tipo {file} já existe!')
Editor is loading...
Leave a Comment