+ 3

How do you import modules with hyphens?

I'm trying to import a module with a hyphen, but when I try to import it like this: Import foo-bar Python thinks that the hyphen is a minus symbol. I have also tried: foo_bar = __import__('foo-bar') But then it says: Module 'foo-bar' not found. I have heard that you should rename the module but I don't know how.

4th Jul 2019, 4:51 PM
Envario
Envario - avatar
2 Answers
+ 1
you can only use Python modules not Java's(called classes in Java)
9th Jul 2019, 3:54 AM
Mind To Machine đŸ’»đŸ•†
Mind To Machine đŸ’»đŸ•† - avatar
+ 1
Mind To Machine The module I tride to import was a Python module it simulated Java's random. I changed it to foo-bar to avoid confusion.
9th Jul 2019, 4:34 PM
Envario
Envario - avatar