Last active
August 29, 2015 14:06
-
-
Save SpotlightKid/8e8647cf3e16f22f8aa0 to your computer and use it in GitHub Desktop.
Print date and time of next PyCologne meeting in German
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"#!/usr/bin/env python\n", | |
"# -*- coding: utf-8 -*-\n", | |
"\n", | |
"import locale\n", | |
"\n", | |
"from dateutil.rrule import rrule, MONTHLY, WE\n", | |
"\n", | |
"DATE_FMT = \"%A, %d. %B %Y, %H:%M Uhr\"\n", | |
"\n", | |
"locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')\n", | |
"\n", | |
"meeting_dates = iter(\n", | |
" rrule(MONTHLY, byweekday=WE(+2), byhour=19, byminute=0, count=12))\n", | |
"\n", | |
"print(\"N\u00e4chstes PyCologne-Treffen: {}\".format(\n", | |
" next(meeting_dates).strftime(DATE_FMT)))\n", | |
"\n", | |
"print(\"\\nNachfolgende Termine:\\n\")\n", | |
"\n", | |
"for date in meeting_dates:\n", | |
" print(\"* {}\".format(date.strftime(DATE_FMT)))\n" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"N\u00e4chstes PyCologne-Treffen: Mittwoch, 10. September 2014, 19:00 Uhr\n", | |
"\n", | |
"Nachfolgende Termine:\n", | |
"\n", | |
"* Mittwoch, 08. Oktober 2014, 19:00 Uhr\n", | |
"* Mittwoch, 12. November 2014, 19:00 Uhr\n", | |
"* Mittwoch, 10. Dezember 2014, 19:00 Uhr\n", | |
"* Mittwoch, 14. Januar 2015, 19:00 Uhr\n", | |
"* Mittwoch, 11. Februar 2015, 19:00 Uhr\n", | |
"* Mittwoch, 11. M\u00e4rz 2015, 19:00 Uhr\n", | |
"* Mittwoch, 08. April 2015, 19:00 Uhr\n", | |
"* Mittwoch, 13. Mai 2015, 19:00 Uhr\n", | |
"* Mittwoch, 10. Juni 2015, 19:00 Uhr\n", | |
"* Mittwoch, 08. Juli 2015, 19:00 Uhr\n", | |
"* Mittwoch, 12. August 2015, 19:00 Uhr\n" | |
] | |
} | |
], | |
"prompt_number": 0 | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import locale | |
from dateutil.rrule import rrule, MONTHLY, WE | |
DATE_FMT = "%A, %d. %B %Y, %H:%M Uhr" | |
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8') | |
meeting_dates = iter( | |
rrule(MONTHLY, byweekday=WE(+2), byhour=19, byminute=0, count=12)) | |
print("Nächstes PyCologne-Treffen: {}".format( | |
next(meeting_dates).strftime(DATE_FMT))) | |
print("\nNachfolgende Termine:\n") | |
for date in meeting_dates: | |
print("* {}".format(date.strftime(DATE_FMT))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment