sb-clock.py 596 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env python
  2. from datetime import datetime
  3. def main():
  4. now = datetime.now()
  5. clock = now.strftime("%I")
  6. print(clock)
  7. icons = {
  8. "00": "🕛",
  9. "01": "🕐",
  10. "02": "🕑",
  11. "03": "🕒",
  12. "04": "🕓",
  13. "05": "🕔",
  14. "06": "🕕",
  15. "07": "🕖",
  16. "08": "🕗",
  17. "09": "🕘",
  18. "10": "🕙",
  19. "11": "🕚",
  20. "12": "🕛",
  21. }
  22. icon = icons[clock]
  23. formatted = now.strftime("%Y %b %d (%a) %I:%M%p")
  24. print(f"{icon} {formatted}")
  25. if __name__ == '__main__':
  26. main()