小编use*_*019的帖子

Python,如何从文件中读取字节并保存?

我想从文件中读取字节,然后将这些字节写入另一个文件,并保存该文件.

我该怎么做呢?

python

30
推荐指数
4
解决办法
11万
查看次数

Python线程:无法启动新线程

我正在尝试运行此代码:

def VideoHandler(id):
    try:
        cursor = conn.cursor()
        print "Doing {0}".format(id)
        data = urllib2.urlopen("http://myblogfms2.fxp.co.il/video" + str(id) + "/").read()
        title = re.search("<span class=\"style5\"><strong>([\\s\\S]+?)</strong></span>", data).group(1)
        picture = re.search("#4F9EFF;\"><img src=\"(.+?)\" width=\"120\" height=\"90\"", data).group(1)
        link = re.search("flashvars=\"([\\s\\S]+?)\" width=\"612\"", data).group(1)
        id = id
        print "Done with {0}".format(id)
        cursor.execute("insert into videos (`title`, `picture`, `link`, `vid_id`) values('{0}', '{1}', '{2}', {3})".format(title, picture, link, id))
        print "Added {0} to the database".format(id)
    except:
        pass

x = 1
while True:
    if x != 945719:
        currentX = x
        thread.start_new_thread(VideoHandler, (currentX))
    else:
        break
    x …
Run Code Online (Sandbox Code Playgroud)

python

0
推荐指数
1
解决办法
1万
查看次数

C#,如何从TcpClient获取IP地址?

C#,如何从TcpClient获取IP地址?

I have a TcpClient and i want to get it's name.
Run Code Online (Sandbox Code Playgroud)

c#

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

python ×2

c# ×1