使用python

时间:2016-03-10 09:02:21

标签: python regex sqlite

我有一个sqlite数据库,比方说test.db.它是我博客的数据库,其中存储了所有博客内容。现在,它有一个名为“posts”的表。 “posts”包含我在博客中写的所有内容。有一个javascript在“帖子”中多次出现,我想用其他东西替换。因此,概念是获取表“posts”然后使用正则表达式选择所有类似的,然后用新的替换它。我使用python脚本从“帖子”中获取数据。我想帮助选择使用正则表达式然后替换。以下是我的代码: -

import sqlite3
conn = sqlite3.connect('/home/bootx/Downloads/test.db')
cur = conn.cursor()

def get_posts():
    cur.execute("SELECT * FROM posts")
    print(cur.fetchall())

get_posts()
conn.commit()
conn.close()
print "Connected fetched"

0 个答案:

没有答案
相关问题