Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Write to db Table
#2
Somewhere in your code, list object is passed instead of a string. Try an IDE to debug.
eg-

1
2
>>> mylist = ['mystring']
>>> mylist.encode('utf-8')
You'll get-

Error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'list' object has no attribute 'encode'

Instead you have to pass the string contained in the list.


1
>>> mylist[0].encode('utf-8'// first element of List
Output:
b'mystring'
Reply


Messages In This Thread
Write to db Table - by VodkaSodaWater - Aug-11-2017, 08:51 PM
RE: Write to db Table - by hbknjr - Aug-12-2017, 09:38 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  write json into a table herobpv 4 2,633 Jan-22-2023, 04:36 AM
Last Post: herobpv
  write mariadb table rows query to each file? shams 1 2,521 Feb-02-2021, 04:10 PM
Last Post: buran
  Write to SQL Table skaailet 1 2,218 Jun-09-2020, 06:43 PM
Last Post: Larz60+
  write csv data into teradata table sandy 0 5,634 Feb-13-2019, 12:11 AM
Last Post: sandy

Forum Jump:

User Panel Messages

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