Package: python-cowsay
Python CowsayA rewrite of cowsay in python. Allows for parsing of existing.cowfiles.Installpip install python-cowsayUsageThe classic cowsay can be generated by thecowsayorcowthinkfunctions:fromcowsayimportcowsaymessage="""The most remarkable thing about my mother is that for thirty years she servedthe family nothing but leftovers.  The original meal has never been found.-- Calvin Trillin""".strip()print(cowsay(message))Will yield:__________________________________________ 
/ The most remarkable thing about my       \
| mother is that for thirty years she      |
| served the family nothing but leftovers. |
| The original meal has never been found.  |
|                                          |
\ -- Calvin Trillin                        /
 ------------------------------------------ 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||The parameters for these functions are:message– a string to wrap in the text bubblecow='default'– the name of the cow (valid names fromlist_cows)preset=None– the original cowsay presets:-bgpstwyeyes=Option.eyes– A custom eye stringtongue=Option.tongue– A custom tongue stringwidth=40– The width of the text bubblewrap_text=True– Whether text should be wrapped in the bubblecowfile=None– A custom string representing a cowOther FunctionsThe available builtin cows can be found withlist_cows. A cow can be chosen
randomly from this list withget_random_cow.Using Your Own CowsA custom.cowfile can be parsed using theread_dot_cowfunction which takes
aTextIOstream. I.e., You can either create aTextIOfrom a string or read
a file.Theread_dot_cowwill look for the first heredoc in the steam and extract the
heredoc contents. If no heredoc exists, the whole stream is used instead. Escape
characters are then escaped. The default escape characters can be changed by
passing in an optionalescapedictionary parameter mapping escape codes to
their chars.For example:fromioimportStringIOfromcowsayimportread_dot_cow,cowthinkcow=read_dot_cow(StringIO("""$the_cow = <<EOC;$thoughts$thoughts___(o o)(  V  )/--m-m-EOC"""))message="""Nothing is illegal if one hundred businessmen decide to do it.-- Andrew Young""".strip()print(cowthink(message,cowfile=cow))Will yield:___________________________________ 
( Nothing is illegal if one hundred )
( businessmen decide to do it.      )
(                                   )
( -- Andrew Young                   )
 ----------------------------------- 
         o
          o
           ___
          (o o)
         (  V  )
        /--m-m-Full-Width CharactersA bit of a hack at the moment, but if any full-width characters are found in the
message string,allcharacters in the thought bubble are converted to
full-width. For example:＿＿＿＿＿＿＿＿＿＿＿＿　
（　喵喵喵。我是一只猫。　）
　－－－－－－－－－－－－　
   o
    o

     |\_/|
     |o o|__
     --*--__\
     C_C_(___)This works fine when all characters in the message are full-width, but does not
work so well when there is a mix of full- and neutral-width characters:＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿　
（　喵喵喵。Ｉ　ａｍ　ａ　ｃａｔ．　）
　－－－－－－－－－－－－－－－－－　
   o
    o

     |\_/|
     |o o|__
     --*--__\
     C_C_(___)Each full-width character still only counts as one character when setting the
text width. For example:fromcowsayimportcowthinkmessage="喵喵喵。我是一只猫。我想吃鱼和喝牛奶。"print(cowthink(message,cow="kitten",width=10))Will yield:＿＿＿＿＿＿＿＿＿＿＿＿　
（　喵喵喵。我是一只猫。　）
（　我想吃鱼和喝牛奶。　　）
　－－－－－－－－－－－－　
   o
    o

     |\_/|
     |o o|__
     --*--__\
     C_C_(___)