Get Year Month & Day as Integers from an ISO 8601 Date String in Python

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

date_str = "2017-01-29"
year_str = date_str[0] + date_str[1] + date_str[2] + date_str[3]
month_str = date_str[5] + date_str[6]
day_str = date_str[8] + date_str[9]
year_int = int(year_str)
month_int = int(month_str)
day_int = int(day_str)
print(year_int)
print(month_int)
print(day_int)
 

topherPedersen