mysql只能插进去一条数据

mysql只能插进去一条数据,并且插入链接失败 显示是 ‘/’ 求帮忙解答一下

import requests
from lxml import etree
import pymysql
def cunimg(url):
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36'
    }
    res = requests.get(url=url, headers=headers)
    res.encoding = 'gbk'
    tree = etree.HTML(res.text)
    li_list = tree.xpath('//ul[@class="tm_list"]/li ')
    for li in li_list:
        name = li.xpath('.//b/text()')
        link = li.xpath('.//a/@href')[0]
        type = li.xpath('.//em/a/text()')
        time = li.xpath('.//em[2]/text()')
        print(name)
        print(link)
        print(type)
        print(time)
    conn = pymysql.connect(host='localhost', port=3306, user='root', password='abc123', db='yfh', charset='utf8')
    cus = conn.cursor()
    sql = 'insert into 4399(1)游戏(name,link,type,time) VALUES(%s,%s,%s,%s)'
    for i in range(0,len(name)):
        n = name[i]
        l = str(link[i])
        t = type[i]
        ti = time[i]
        cus.execute(sql, (n, l, t, ti))
        conn.commit()
        cus.close()
        conn.close()


if __name__ == '__main__':
    url = 'http://www.4399.com/flash/gamehw.htm'
    cunimg(url)

img

img

你的缩进不对,导致只执行了一次。
21到32行要向右缩进一格吧