I am quite new to coding (I actually started 3 days ago), so please bare with me in case this question is easy to solve.
Here is my problem:
- I connected myself to my db and requested data from db using
mysql.connectorin PyCharm - I want the result to be a plain string and assign this "plain" data to a variable so I can use it later in my code
- I do get the result in a different way (is it a list?)
So here is my code:
mycursor = mydb.cursor()
mycursor.execute("select firstname from customer c join application a on a.customerid = c.id where c.id=1;")
firstname = mycursor.fetchall()
print(firstname)
My current output:
[('Max',)]
My expected output:
Max
Any ideas how I can convert firstname to my desired format?
Thanks in advance!
fetchoneand then get the first column withrow[0][('',)]