I am new to python. I can not figre out how to write a sql server table row to an output file. I can pt it on the screen but can't write it to a file.
import pyodbc
f.open(‘c:\python27\out.txt’,w)
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;DATABASE=vzw;trusted_connection=True')
cursor = cnxn.cursor()
cursor.execute ("select * from vzw.dbo.threcord")
row = cursor.fetchall()
print row # displays row on screen
f.write #what goes here to indicate the displayed row?