gecosistema_lite/strings.py
def density(text, chars=None):
    """
    density
    Returns the list of char ordered by density
    """
    dic = {}
    chars = set(text) & set(chars) if chars else set(text)
    for c in text:
        if c in chars:
            dic[c] = 1 if not dic.has_key(c) else dic[c] + 1
    dic = (sorted(dic.items(), key=lambda x: x[1], reverse=True))
    dic = [key for (key, value) in dic]
    return dic

    density
    Returns the list of char ordered by density
    
density
Returns the list of char ordered by density
density Returns the list of char ordered by density
def density(text, chars=None):
    dic = {}
    chars = set(text) & set(chars) if chars else set(text)
    for c in text:
        if c in chars:
            dic[c] = 1 if not dic.has_key(c) else dic[c] + 1
    dic = (sorted(dic.items(), key=lambda x: x[1], reverse=True))
    dic = [key for (key, value) in dic]
    return dic
def density ( text , chars = None ) : dic = { } chars = set ( text ) & set ( chars ) if chars else set ( text ) for c in text : if c in chars : dic [ c ] = 1 if not dic . has_key ( c ) else dic [ c ] + 1 dic = ( sorted ( dic . items ( ) , key = lambda x : x [ 1 ] , reverse = True ) ) dic = [ key for ( key , value ) in dic ] return dic
density
Returns the list of char ordered by density
density Returns the list of char ordered by density
"""
    density
    Returns the list of char ordered by density
    """
text
chars