내가이 코드를 실행하고 때형식 오류가 : 정수는 파이썬 MySQL은 필요합니다
Traceback (most recent call last):
File "C:\Users\Bishnu\Desktop\database", line 6, in <module>
db = "student")
File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
TypeError: an integer is required
:
import MySQLdb
db = MySQLdb.connect(host = "127.0.0.1",
port = "3306",
user="Bishnu",
passwd = "Pulchowk",
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]
db.cose()
을이 같은 오류를 제공합니다
무엇입니까? TypeError : 정수가 필요합니다.
왜 이러한 문제가 발생합니까? 이 코드를 실행하려면 3 가지 문제가 있지만 다행스럽게도이 포럼은 내 두 가지 문제를 해결했으며 문제도 해결 될 것이라고 생각하십니까? 교체
MySQL 서버에 연결하지 못할 수 있습니다 (따옴표를 제거). 그것의 실행을 확인하십시오. –
MySQL 서버가 실행 중이지만 여전히 동일한 문제가 있음을 확신합니다. 하지만 제 친구도 그것을 시도했지만 아무런 문제가 없습니다. 그것에 대해 어떤 아이디어가 있습니까? –