Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Programmatically determining programming languages based on file extensions in python

# 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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Programmatically #determining #programming #languages #based #file #extensions #python
ADD COMMENT
Topic
Name
6+9 =