本文整理汇总了Python中convert.Convert.CSV_FILE_LOCATION方法的典型用法代码示例。如果您正苦于以下问题:Python Convert.CSV_FILE_LOCATION方法的具体用法?Python Convert.CSV_FILE_LOCATION怎么用?Python Convert.CSV_FILE_LOCATION使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类convert.Convert
的用法示例。
在下文中一共展示了Convert.CSV_FILE_LOCATION方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Convert
# 需要导入模块: from convert import Convert [as 别名]
# 或者: from convert.Convert import CSV_FILE_LOCATION [as 别名]
"""
Converts a Toggl CSV to ICS.
"""
import sys
# Yeah this is a hack
sys.path.append('.')
from convert import Convert
from datetime import datetime
convert = Convert()
convert.CSV_FILE_LOCATION = 'toggl.csv'
convert.SAVE_LOCATION = 'toggl.ics'
convert.HEADER_COLUMNS_TO_SKIP = 2
convert.NAME = 2
togglPROJECT = 3
togglDESCRIPTION = 5
togglUSERNAME = 0
convert.START_DATE = 7
togglSTART_TIME = 8
convert.END_DATE = 9
togglEND_TIME = 10
convert.DESCRIPTION = 12
convert.LOCATION = 13
convert.read_csv()
for row in convert.csv_data:
row[convert.NAME] = row[convert.NAME]+' - '+row[togglPROJECT]+': '+row[togglDESCRIPTION]+' - '+row[togglUSERNAME]
row[convert.START_DATE] = datetime.strptime(row[convert.START_DATE]+' '+row[togglSTART_TIME], '%Y-%m-%d %H:%M:%S')
示例2: Convert
# 需要导入模块: from convert import Convert [as 别名]
# 或者: from convert.Convert import CSV_FILE_LOCATION [as 别名]
"""
This file is an exmaple for running the conversion script
"""
import sys
# Yeah this is a hack
sys.path.append('.')
sys.path.append('../')
from convert import Convert
from datetime import datetime, timedelta
convert = Convert()
convert.CSV_FILE_LOCATION = 'examples/BostonCruiseTerminalSchedule.csv'
convert.SAVE_LOCATION = 'examples/arrive.ics'
convert.HEADER_COLUMNS_TO_SKIP = 2
convert.NAME = 3
convert.START_DATE = 7
convert.END_DATE = 8
convert.DESCRIPTION = 6
convert.LOCATION = 9
convert.read_csv()
i = 0
while i < len(convert.csv_data):
row = convert.csv_data[i]
start_date = row[2] + '-'+row[convert.START_DATE]
try:
row[convert.START_DATE] = datetime.strptime(start_date, '%m/%d/%y-%H:%M')
row[convert.END_DATE] = row[convert.START_DATE]+timedelta(hours=1)
i += 1
示例3: Convert
# 需要导入模块: from convert import Convert [as 别名]
# 或者: from convert.Convert import CSV_FILE_LOCATION [as 别名]
"""
This file is an exmaple for running the conversion script
"""
import sys
# Yeah this is a hack
sys.path.append('.')
sys.path.append('../')
from convert import Convert
from datetime import datetime, timedelta
convert = Convert()
convert.CSV_FILE_LOCATION = 'home/mwynn/csv.csv'
convert.SAVE_LOCATION = 'home/mwynn/calendar-converted.ics'
convert.read_csv()
convert.make_ical()
convert.save_ical()