Skip to content

Instantly share code, notes, and snippets.

@mattdennewitz
Forked from tamask/acronym.py
Created December 14, 2012 18:18

Revisions

  1. @tamask tamask created this gist Dec 14, 2012.
    16 changes: 16 additions & 0 deletions acronym.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #!/usr/bin/env python

    import sys

    last = ''
    punc = ','

    while True:
    c = sys.stdin.read(1)
    if c:
    if c in punc or c.isalpha() and not last.isalpha() and last not in ('\'',):
    sys.stdout.write(c.upper())
    last = c
    else:
    sys.stdout.write('\n')
    break