Importing library into python

1

Hello,

I'm not able to import any library in python using pycharm. When I type, for example, the command import time , the words go gray and do not bring anything.

    
asked by anonymous 12.06.2018 / 03:04

2 answers

0

As @Haynesss commented, PyCharm indicates every time a variable or even an import is not used. This is good practice.

Anyway, as a bonus, it's always interesting to define which python interpreter you're using in PyCharm.

Take a look at in the PyCharm documentation for the python interpreter configuration . It's English, but it's a starting point.

    
12.06.2018 / 15:39
0

When the import goes gray, it is because you are not using it.

What I suspect you are doing is the following:

import time
sleep(2)

This does not work because you're only importing the name time . To use the library, you need to access its functions like this:

import time
time.sleep(2)

Or, importing all module names, as follows:

from time import *
sleep(2)
    
12.06.2018 / 15:57