ngamsCore.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:ngas 作者: ICRAR 项目源码 文件源码
def createSortDicDump(dic):
    """
    Create a sorted ASCII representation of a dictionary. The order is sorted
    according to the dictionary keys.

    dic:     Source dictionary (dictionary).

    Returns: Sorted dictionary ASCII representation (string).
    """
    if (type(dic) != types.DictType):
        raise Exception, "Object given is not a dictionary"
    keys = dic.keys()
    keys.sort()
    asciiDic = ""
    for key in keys: asciiDic += ", '%s': '%s'" % (key, dic[key])
    asciiDic = "{" + asciiDic[2:] + "}"
    return asciiDic
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号