title: OS X Terminal Output in Python
body: <p>This is going to be the easiest question for someone to solve, but I can't seem to find the answer. I've got a really simple program that prints the date, and time. I'm trying to run it from the terminal in OS X, as that is how it'll be run when I hand it in to my prof. I've been told the way to run this is with a command like this:</p>
  
  <pre><code>XXX-MacBook-Air:~ XXX$ sudo chmod a+x /Users/[path]/currenttime.py
  </code></pre>
  
  <p>But when I do that, the print statement in the script doesn't output anywhere. I'm not sure if it is supposed to output in terminal, or where it would print to.</p>
  
  <p>Below is my script for anyone who wants more info on my rookie struggles:</p>
  
  <pre><code>import datetime
  
  #!/usr/bin/env python
  
  def currenttime():
  date1 = str(datetime.datetime.now())
  day = date1[8:10] #not stripped at all
  day2= day.lstrip("0") #strip leading zeros
  if len(day2) == 2:
      #then we have a two digit day and we should work with the last digit
      if day2[1] == 1:
          day_suffix = 'st'
      elif day2[1] == 2:
          day_suffix = 'nd'
      elif day2[1] == 3:
          day_suffix = 'rd'
      else:
          day_suffix = 'th'
  else:
      #one digit day, run off the single digit
      if day2 == 1:
          day_suffix = 'st'
      elif day2 == 2:
          day_suffix = 'nd'
      elif day2 == 3:
          day_suffix = 'rd'
      else:
          day_suffix = 'th'
  month = date1[5:7]
  #we can use the month to search through a dictionary and return the english name
  month_dict= {'01' : 'January', '02': 'February', '03': 'March', '04': 'April', '05': 'May', '06': 'June', '07': 'July', '08': 'August', '09': 'September', '10': 'October', '11': 'November', '12': 'December'}
  year = date1[0:4]
  hour = date1[11:13]
  minute = date1[14:16]
  print("Printed on the " + day2 + day_suffix + " day of " + month_dict[month] + ", " + year + " at " + hour + ":" + minute)
  
  currenttime()
  </code></pre>