Q:

AttributeError: 'module' object has no attribute 'webdriver'

AttributeError: 'module' object has no attribute 'webdriver'

why this error happen when write 
import selenium 

and when write code like this no error happen
from selenium import webdriver

A:

You get an error because webdriver is a module inside the selenium module, and you can't access modules without an explicit import statement.
If you take a look at help(selenium), you'll see there are two modules and one non-module contained inside.
PACKAGE CONTENTS
    common (package)
    selenium
    webdriver (package)

And it behaves according to what I described above:
>>> selenium.common # doesn't work
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'common'
>>> from selenium import common # works
>>> selenium.selenium # works
<class 'selenium.selenium.selenium'>
>>> selenium.webdriver # doesn't work
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'webdriver'
>>> from selenium import webdriver # works
>>> 

