📜  python代码示例中基于文件扩展名以编程方式确定编程语言

📅  最后修改于: 2022-03-11 14:46:00.285000             🧑  作者: Mango

代码示例1
# use: https://github.com/blakeembrey/language-map/blob/master/languages.json
# Github Linguist map as dict for referance

language_results = list(map(
        lambda file_args: file_args[0] if file_extension in list(map(
            lambda i: i, file_args[1].get("extensions", []))) else None, language_map.items()))
language_results = list(filter(None, language_results))
return language_results[0] if len(language_results) > 0 else None