Quering Mysql Databases

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kumar01
    New Member
    • Nov 2016
    • 1

    Quering Mysql Databases

    Hi am new to python,
    am trying fetch data from mysql DB and need to manipulated it.
    the data type of Output query is tuple but i need it in int to perform arithmetic operation. kindly suggest.

    cursor = cnx.cursor()
    cursor.execute( "SELECT mobileno FROM mobile")
    rows = cursor.fetchall ()
    print('Total Row(s):', cursor.rowcount )
    for row in rows:
    print(type(row[0]))
  • dwblas
    Recognized Expert Contributor
    • May 2008
    • 626

    #2
    See Harry George's answer at https://bytes.com/topic/python/answe...46-typecasting

    Comment

    Working...