datetime लाइब्रेरी और Split फंक्शन

Python में Financial Forecasting

Victoria Clark

CGMA Financial Analyst

टकराव के प्रकार

तारीख: 09/10/2018

क्षेत्रीय अंतर

  • Day-Month-Year
  • Month-Day-Year

विराम-चिह्न के अंतर

  • dd-mm-yy
  • dd/mm/yyyy

वित्तीय विवरण

Python में Financial Forecasting

datetime फंक्शन

# Import datetime module
from datetime import datetime

datetime.strptime(date_string, format)

12-25-2000 --> %m-%d-%Y'

datetime.strptime('12-25-2000',
                  '%m-%d-%Y')

print(dt_object.month)
12

तारीखें

Python में Financial Forecasting

split() फंक्शन का उपयोग

  • split() फंक्शन
date = '14/02/2018'

# / का उपयोग करके तारीख स्ट्रिंग को नाम वाले वैरिएबल में बाँटें day, month, year = date.split('/')
print(year)
2018
Python में Financial Forecasting

अभ्यास करते हैं!

Python में Financial Forecasting

Preparing Video For Download...