Python Forum
Write SQLite query result to file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write SQLite query result to file
#1
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?
Reply
#2
Have a look at these links
https://www.pythonforbeginners.com/files...-in-python
https://www.tutorialspoint.com/sqlite/sqlite_python.htm
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
Gaming Collection
Homepage
my-python
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Read file, reformat and write new file bryanmartin113 1 204 Jun-08-2021, 09:27 PM
Last Post: Larz60+
  write mariadb table rows query to each file? shams 1 491 Feb-02-2021, 04:10 PM
Last Post: buran
  Read/Write binary file deanhystad 3 543 Feb-01-2021, 10:29 AM
Last Post: Larz60+
  Running A Parser In VSCode - And Write The Results Into A Csv-File apollo 5 819 Jan-14-2021, 08:58 PM
Last Post: snippsat
  How do I write a single 8-bit byte to a file? MysticLord 2 739 Sep-03-2020, 12:27 PM
Last Post: MysticLord
  unable to write to log file Mekala 2 637 Aug-12-2020, 11:02 PM
Last Post: Mekala
  List Won't Write in Text File IILawrenceII 4 696 Jul-17-2020, 11:16 PM
Last Post: j.crater
  Importing data from a text file into an SQLite database with Python macieju1974 7 1,028 Jun-29-2020, 08:51 PM
Last Post: buran
  Process Data from one csv file and write to another CSV file specific column ajin9581 1 668 Jun-17-2020, 06:00 PM
Last Post: buran
  Append JSON's and write to file faqsap 4 1,031 May-15-2020, 04:20 PM
Last Post: faqsap

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020