has and Dethe wrote: >def bool2cm0k(lst): > """Converts a list of booleans to a CMYK color string, > e.g. [True, False, False, True] to 'C00K' > """ > return ''.join([b and c or '0' for b, c in zip(lst, 'CMYK')]) > >def cm0k2bool(s): > """Converts a CMYK color string to a list of booleans, > e.g. 'CM0K' to [True, True, False, True] > """ > return [x != '0' for x in s] > >print bool2cm0k([True, False, False, True]) # --> C00K >print cm0k2bool('CM0K') # --> [True, True, False, True]
Thank you all very much! This is what I imagined! :-) Best regards, Henning Hraban Ramm Südkurier Medienhaus / MediaPro Support/Admin/Development Dept. _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig