How to import the directory contains `-` in Python?

qg_java_17137

How to import the directory contains - ?

from gib-bin.Test import print_test

print_test()

Error:

from gib-bin.Test import print_test
        ^
SyntaxError: invalid syntax
SitiSchu

You don't. Either remove the Hyphen or Replace it with an Underscore.

Name the package gib_bin or gibbin.

Also look at PEP 8:

Package and Module Names Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.

Since module names are mapped to file names, and some file systems are case insensitive and truncate long names, it is important that module names be chosen to be fairly short -- this won't be a problem on Unix, but it may be a problem when the code is transported to older Mac or Windows versions, or DOS.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to Import python package from another directory?

From Dev

Why does import work with Python nose when test directory contains __init__.py?

From Dev

How to import directory in libsass

From Dev

Check if a given directory contains any directory in python

From Dev

Python, how can I import modules that are in sub-directory?

From Dev

How to import python class file from same directory?

From Dev

How do I import something from a nested child directory with Python?

From Dev

How to import python module given a certain directory structure

From Dev

How to import a Python module with relative path to a file from another directory?

From Dev

Python import from parent directory

From Dev

How to import a package located in its parent directory using absolute import in Python 3?

From Dev

How do I make "from directory import outer-directory" work within Python?

From Dev

How do I make "from directory import outer-directory" work within Python?

From Dev

Python - Choose directory that contains a specific string

From Dev

How to import CSV into mysql if values contains comma

From Dev

How to import CSV into mysql if values contains comma

From Dev

How to import the text contains comma in Ruby on Rails

From Dev

How to check if directory contains file which name contains certain string?

From Dev

How to check if PATH already contains a particular directory

From Dev

how to find the directory that contains the test with the last date?

From Dev

How to check if PATH already contains a particular directory

From Dev

python import from a sub-sub directory

From Dev

Unable to import .xlsx into Python: No such file or directory

From Dev

Python folder structure for project directory and easy import

From Dev

python package import from different directory

From Dev

Import a python class from an upper directory

From Dev

How to import from both a python file in a folder and a file on the same directory being called?

From Dev

How to import a directory with modules to Python path that is a symlink to original source from a subfolder?

From Dev

How to import from both a python file in a folder and a file on the same directory being called?

Related Related

  1. 1

    How to Import python package from another directory?

  2. 2

    Why does import work with Python nose when test directory contains __init__.py?

  3. 3

    How to import directory in libsass

  4. 4

    Check if a given directory contains any directory in python

  5. 5

    Python, how can I import modules that are in sub-directory?

  6. 6

    How to import python class file from same directory?

  7. 7

    How do I import something from a nested child directory with Python?

  8. 8

    How to import python module given a certain directory structure

  9. 9

    How to import a Python module with relative path to a file from another directory?

  10. 10

    Python import from parent directory

  11. 11

    How to import a package located in its parent directory using absolute import in Python 3?

  12. 12

    How do I make "from directory import outer-directory" work within Python?

  13. 13

    How do I make "from directory import outer-directory" work within Python?

  14. 14

    Python - Choose directory that contains a specific string

  15. 15

    How to import CSV into mysql if values contains comma

  16. 16

    How to import CSV into mysql if values contains comma

  17. 17

    How to import the text contains comma in Ruby on Rails

  18. 18

    How to check if directory contains file which name contains certain string?

  19. 19

    How to check if PATH already contains a particular directory

  20. 20

    how to find the directory that contains the test with the last date?

  21. 21

    How to check if PATH already contains a particular directory

  22. 22

    python import from a sub-sub directory

  23. 23

    Unable to import .xlsx into Python: No such file or directory

  24. 24

    Python folder structure for project directory and easy import

  25. 25

    python package import from different directory

  26. 26

    Import a python class from an upper directory

  27. 27

    How to import from both a python file in a folder and a file on the same directory being called?

  28. 28

    How to import a directory with modules to Python path that is a symlink to original source from a subfolder?

  29. 29

    How to import from both a python file in a folder and a file on the same directory being called?

HotTag

Archive