Tags | File and directory naming python |
Hard Prerequisites |
|
When naming files and directories in Python, you should use small letters and underscores to separate your words. This type of naming convention is called snake_case and is also used in naming Python variable and function names.
Based on the above guidelines, which of the following is a good way to name a Python directory?
> apyhthondirectory
> a_python_directory
> a-python-directory
> APYTHONDIRECTORY
> ApythonDirectory
We are curious as to what your answer was! See below for some tips in naming your directories.
> good_directory_name
> bad-directory-name
> AnotherBadDirectoryName
> AVERYBADDIRECTORYNAME
> nevernameyourdirectorylikethis
Test yourself again - do any of the examples below follow the recommended Python naming guidelines?
> task.python
> task-1.1.py
> task1.1.py
> python-module.py
> my_file .py
In case you found the above a bit tricky, see a few more rule abiding file names below.
> task_1.py
> task_1_1.py
> good_python_file.py
> keep_it_short.py
> must_be_meaningful.py