24 lines
666 B
Python
24 lines
666 B
Python
import csv
|
||
from datetime import datetime, timedelta
|
||
|
||
|
||
def csv_to_ics(csv_file_path):
|
||
ics_content = [
|
||
"BEGIN:VCALENDAR",
|
||
"VERSION:2.0",
|
||
"PRODID:-//MUT_TS//Birthdays//RU",
|
||
"CALSCALE:GREGORIAN"
|
||
]
|
||
|
||
with open(csv_file_path, mode='r', encoding='utf-8') as file:
|
||
# Предполагаем, что разделитель - запятая. Если точка с запятой, измените на delimiter=';'
|
||
reader = csv.DictReader(file, delimiter=';')
|
||
|
||
|
||
return reader
|
||
|
||
|
||
|
||
# Запуск конвертации
|
||
print(list(csv_to_ics('1.csv')))
|
||
print("Файл birthdays.ics успешно создан!") |