After fetching the link from the database, it prints out like this,
(u'https://www.baidu.com',)
The type of this field in the database is Varchar, this is the code
for row in results:
print row
I printed it directly as https://www.baidu.com
. What should I do?
You should be
Then the database is taken out as a
tuple
, which is returned in the order of yourselect
, so just print the first element directlyThe database field of VARCHAR type corresponds to the string in Python. Haven’t you already obtained it?
If you want to use it as a value, just write: