Untitled

mail@pastecode.io avatar
unknown
plain_text
24 days ago
828 B
2
Indexable
Never
import csv
import random

def generate_key():
    return random.randint(10000000, 99999999)

def create_csv(input_txt_file, output_csv_file):
    with open(input_txt_file, 'r') as txt_file:
        emails = [line.strip() for line in txt_file.readlines()]

    with open(output_csv_file, 'w', newline='') as csv_file:
        fieldnames = ['Key', 'Email']
        writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
        
        writer.writeheader()
        
        for email in emails:
            key = generate_key()
            writer.writerow({'Key': key, 'Email': email})

if __name__ == "__main__":
    input_txt_file = "list.txt"  # Remplacez par le chemin de votre fichier texte
    output_csv_file = "danois.csv"  # Remplacez par le chemin de sortie souhaité

    create_csv(input_txt_file, output_csv_file)
Leave a Comment