;;;  Pls tell me about little tricks you use in Python or Lisp.


[('the', 36225), ('and', 17551), ('of', 16759), ('i', 16696), ('a', 15816), ('to', 15722), ('that', 11252), ('in', 10743), ('it', 10687)]

((the 36225) (and 17551) (of 16759) (i 16696) (a 15816) (to 15722) (that 11252) (in 10743) (it 10687))


i think the latter is easier-to-read, so i use this code
                                                       (by Peter Norvig)

def lispstr(exp):
           # "Convert a Python object back into a Lisp-readable string."
    if isinstance(exp, list):
        return '(' + ' '.join(map(lispstr, exp)) + ')'
    else:
        return str(exp)

def Lprint(x): print(lispstr(x))
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to