a This is trouble me for two days, I am new one to python, I want to Parse the html data as the following link:http://movie.walkerplus.com/list/2015/12/
and then store the data into the postgresql database named movie_db, and there is table named films which is created by the following command:
CREATE TABLE films (
title varchar(128) NOT NULL,
description varchar(256) NOT NULL,
directors varchar(128)[],
roles varchar(128)[]
);
I have parsed data, there are three list data for title, description, director, roles. such as title =['a', .....,'b'], description = ['c',....,'f'], director= ['d',.....,'g'], roles = [['f','g','t'], ......,['h', 't','u']].
sql = "INSERT INTO films (title, description, directors, roles)
VALUES
(%s, %s, %s, %s);"
for obj in zip(t, des, dirt, r):
cur.execute(cur.mogrify(sql, obj))
conn.commit()
There is error:
psycopg2.DataError: malformed array literal: "サ�?��?��?��?��?�ス"
LINE 1: ...�?��?�ズ�?��?��?��?��?��?��?�を描�?�『007』シ�?��?�ズ第24作', 'サ�?��?��?�...
^
DETAIL: Array value must start with "{" or dimension information.