1

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
DavidG
  • 24,279
  • 14
  • 89
  • 82
qg_java_17137
  • 3,310
  • 10
  • 41
  • 84

1 Answers1

2

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.

Community
  • 1
  • 1
SitiSchu
  • 1,361
  • 11
  • 20