Hi all, This does not feel Pythonic. Is there a better way to do the same? Many TIA T
# L = [1,2,3,4,5,6, etc....] # L can contain 'n' elements # fmt is made up to each particular specification if len(L) == 0: return '' elif len(L) == 1: return struct.pack(fmt,L[0] ) elif len(L) == 2: return struct.pack(fmt,L[0] , L[1]) elif len(L) == 3: return struct.pack(fmt,L[0] , L[1], L[2]) elif len(L) == 4: return struct.pack(fmt,L[0] , L[1], L[2], L[3]) elif len(L) == 5: return struct.pack(fmt,L[0] , L[1], L[2], L[3], L[4]) elif len(L) == 6: return struct.pack(fmt,L[0] , L[1], L[2], L[3], L[4], L[5]) # etc... etc... etc ... -- http://mail.python.org/mailman/listinfo/python-list