Report Bug

Qus

What does the following code do?

from datetime import datetime
dt = datetime.strptime("2024-11-22", "%Y-%m-%d")
print(dt)
Qus

नीचे दिए गए code का output क्या है?

from datetime import datetime
dt = datetime.strptime("2024-11-22", "%Y-%m-%d")
print(dt)


A. Returns the current date
B. Converts the string "2024-11-22" to a datetime object
C. Returns the string "2024-11-22"
D. Raises a ValueError


Solution
B. Converts the string "2024-11-22" to a datetime object



Explanation
strptime() parses a date string according to the specified format and creates a datetime object. <br><br> strptime() दिए गए format के अनुसार string को parse करके datetime object बनाता है।
Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad