Write SQLite query result to file - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Write SQLite query result to file (/thread-27137.html) |
Write SQLite query result to file - hjk6734 - May-27-2020 I need to write a SQLite query result in a file: c.execute("SELECT * FROM mytable ORDER BY date(Date) ASC LIMIT 1;") f.write(c.fetchone()) but I get this error: TypeError: argument 1 must be string or read-only character buffer, not None how can I solve this? RE: Write SQLite query result to file - menator01 - May-27-2020 Have a look at these links https://www.pythonforbeginners.com/files/reading-and-writing-files-in-python https://www.tutorialspoint.com/sqlite/sqlite_python.htm |