naming - Is it ok to use dashes in Python files when trying to import them? -


basically when have python file like:

python-code.py 

and use:

import (python-code) 

the interpreter gives me syntax error.

any ideas on how fix it? dashes illegal in python file names?

you should check out pep 8, style guide python code:

package , module names modules should have short, all-lowercase names. underscores can used in module name if improves readability. python packages should have short, all-lowercase names, although use of underscores discouraged.

since module names mapped file names, , file systems case insensitive , truncate long names, important module names chosen short -- won't problem on unix, may problem when code transported older mac or windows versions, or dos.

in other words: rename file :)


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -