title: How to access meridiem of a time in Python?
body: <p>I have a problem in accessing the meridiem part of time using Python.</p>
  
  <p>Consider this code in python:-</p>
  
  <pre><code>import datetime
  time = input("Enter the time : (HH:MM:AM/PM)")
  # the above time is in string format so to make it in datetime.datetime type
  # we need to use strptime function.
  time = datetime.datetime.strptime(time, "%H:%M:%p")
  # now to access different parts of variable time:-
  print(time.hour)  # to access hour
  print(time.minute)  # to access minute
  </code></pre>
  
  <p>But I don't know how to check whether the user entered AM or PM.
  Try to help</p>
  
  <p>Thank's</p>