0

I am querying from a database using PYODBC as below:

cursor.execute("SELECT Distinct country from dbo.purchases")

for row in cursor.fetchall():
    print row

The Result of the script is as so:

('Taiwan', )
('Japan', )

How can I format the pyodbc output query to just:

Taiwan
Japan

1 Answer 1

1

The result is a tuple, so print row[0].

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.