2013-01-23 8 views
0

저는 Python 2.7 및 mysql-python 2.7을 설치했습니다.모듈 객체에는 아무런 속성이 없습니다 connect

import MySQLdb 
db = MySQLdb.connnect(host = "localhost", 
         user="Bishnu Bhattarai", 
         passwd = "password", 
         db = "student") 
cursor =db.cursor() 
cursor.execute("select * from basic_info") 
numrows = int(cursor.rowcount) 
for x in range(0,numrows): 
    row = cursor.fetchall() 
    print row[0],"-->",row[1] 

그러나 오류 보여줍니다 :이 코드는 파이썬에서 MySQL의 테스트 실행하려는

Traceback (most recent call last): 
    File "C:\Users\Bishnu\Desktop\database", line 2, in <module> 
    db = MySQLdb.connnect(host = "localhost", 
AttributeError: 'module' object has no attribute 'connnect' 

문제가 무엇입니까?

답변

4

connect에서 세 번째 'n'을 삭제 해보세요.

관련 문제