import os numbers = [] group_name = input("Enter the group name: ") while True: number = input("Enter a phone number (or press Enter to finish): ") if number == "": break numbers.append(number) filename = f"{group_name}_contacts.vcf" with open(filename, 'w') as f: for i, number in enumerate(numbers, start=1): f.write("BEGIN:VCARD\n") f.write("VERSION:3.0\n") f.write(f"N:{group_name}_{i:03d};;;\n") f.write(f"FN:{group_name}_{i:03d}\n") f.write(f"TEL;TYPE=CELL:+91{number}\n") f.write(f"X-WhatsApp-Group:{group_name}\n") # Add WhatsApp group tag f.write("END:VCARD\n\n") print(f"A single VCF file '{filename}' with {len(numbers)} contacts has been created in the current directory.") print(f"These contacts are tagged for easy addition to a WhatsApp group named '{group_name}'.")