#########sample########## sqlite3.OperationalError: Could not decode to UTF-8 column 'logtype' with text 将 with connection.cursor() as c: c.execute("select id,name from district_info where p_id=0") provinces = c.fetchall() 调整为 con = sqlite3.conn…
一. 不同用户下配置virtualenvwrapper的问题 问题描述: 安装virtualnev和virtualnevwrapper之后,在.bashrc进行virtualenvwrapper的相关配置后重新加载.bashrc文件时报错. 报错内容大致如下: /usr/bin/python: No module named virtualenvwrapper virtualenvwrapper.sh: There was a problem running the initialization…
我在看<父与子的编程之旅>的时候,有段代码是随机画100个矩形,矩形的大小,线条的粗细,颜色都是随机的,代码如下, import pygame,sys,random from pygame.color import THECOLORS pygame.init() screen = pygame.display.set_mode([640,480]) screen.fill([255,255,255]) for i in range(100): width = random.randint(0,…
在 python2 中zip可以将两个列表并入一个元组列表,如: a = [1,2,3,4] b = [5,6,7,8] c = zip(a,b) 结果:c [(1,5),(2,6),(3,7),(4,8)] 在python3中zip返回值有所改变: >>> a = [1,2,3,4]>>> b = [5,6,7,8]>>> c = zip(a,b)>>> c<zip object at 0x03496878> 可以看到返…