2007年04月28日 星期六 10:44
hi all 看过limodou的邮件说karrigell的dbstorage可以将dict类型直接存入数据库 不知道sqlobject是否有这种功能呢 -- with kind regards
2007年04月28日 星期六 10:59
¿ÉÄÜÎÒÕâ±ßµÄ±àÂë³öÁËÎÊÌ⣬ÎÒ·¢ÁËһЩÎÞЧµÄÓʼþ¡£±§Ç¸£¡ yhwu 2007-04-28 -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070428/00577347/attachment.htm
2007年04月28日 星期六 11:09
On 4/28/07, yhwu <yhwu在b-star.cn> wrote: > > > 可能我这边的编码出了问题,我发了一些无效的邮件。抱歉! > > 在svn中,3.7 -- I like python! UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad My Blog: http://www.donews.net/limodou
2007年04月28日 星期六 11:11
¿ÉÒÔͨ¹ýpickleÄ£¿é°Ñdict¶ÔÏóдÈëÎļþ ²»ÖªµÀÎļþ¸údbÐÔÄÜÏà²î¶àÉÙ£¿ 2007/4/28, ro <rosettas在gmail.com>: > > hi all > > ¿´¹ýlimodouµÄÓʼþ˵karrigellµÄdbstorage¿ÉÒÔ½«dictÀàÐÍÖ±½Ó´æÈëÊý¾Ý¿â > ²»ÖªµÀsqlobjectÊÇ·ñÓÐÕâÖÖ¹¦ÄÜÄØ > > -- > with kind regards > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- Best Regrads, DanielSong -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070428/fd1ab8ff/attachment.html
2007年04月28日 星期六 11:23
On 4/28/07, danielsong <sjtusongyi在gmail.com> wrote: > 可以通过pickle模块把dict对象写入文件 > 不知道文件跟db性能相差多少? 算法得当的话绝对比db的性能高 不过麻烦,呵呵 我想到的办法是转换成字符串存进去然后取出来再转换成dict name1={'title':'HelloWorldTitle','content':'HelloWorld'} str1 = str(nameSpace) name2 = eval(str1) -- with kind regards
2007年04月28日 星期六 12:07
´N¬O¥Îpickle¥i¥H¡C -------------- 下一部分 -------------- ¤@?HTMLªþ¥ó³Q²¾°£... URL: http://python.cn/pipermail/python-chinese/attachments/20070428/3c8fc0fc/attachment.htm
2007年04月28日 星期六 12:25
pickle.dump/load ÔÚ07-4-28£¬ro <rosettas在gmail.com> дµÀ£º > > On 4/28/07, danielsong <sjtusongyi在gmail.com> wrote: > > ¿ÉÒÔͨ¹ýpickleÄ£¿é°Ñdict¶ÔÏóдÈëÎļþ > > ²»ÖªµÀÎļþ¸údbÐÔÄÜÏà²î¶àÉÙ£¿ > > Ëã·¨µÃµ±µÄ»°¾ø¶Ô±ÈdbµÄÐÔÄÜ¸ß > ²»¹ýÂé·³,ºÇºÇ > > ÎÒÏëµ½µÄ°ì·¨ÊÇת»»³É×Ö·û´®´æ½øÈ¥È»ºóÈ¡³öÀ´ÔÙת»»³Édict > name1={'title':'HelloWorldTitle','content':'HelloWorld'} > str1 = str(nameSpace) > name2 = eval(str1) > > -- > with kind regards > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- Best Regrads, DanielSong -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070428/b2877174/attachment.html
2007年04月29日 星期日 08:36
On 4/28/07, danielsong <sjtusongyi在gmail.com> wrote: > > pickle.dump/load 这两个函数针对sqlobject怎么玩 -- with kind regards
2007年04月29日 星期日 08:56
ro 写道: > On 4/28/07, danielsong <sjtusongyi在gmail.com> wrote: > >> pickle.dump/load >> > > 这两个函数针对sqlobject怎么玩 > > 把pickle后的结果通过sqlobject使用Binary数据类型保存。不过这样的话就无法 用SQL来操纵数据对象了,除非使用SQL服务器的 Python扩展。 -- 大管家网上建材超市 装修买建材 上网找大管家 http://www.homemaster.cn Tel: 0086-21-34240987 Fax: 0086-21-64692422
2007年04月29日 星期日 09:34
> 把pickle后的结果通过sqlobject使用Binary数据类型保存。不过这样的话就无法 > 用SQL来操纵数据对象了,除非使用SQL服务器的 Python扩展。 OK,明白 但是似乎应该是string数据类型 另外我检讨一下,没有看文档,实际sqlobject有提供一个PickleCol类型.可以直接保存python对象 -- with kind regards
2007年04月29日 星期日 09:47
ro 写道: >> 把pickle后的结果通过sqlobject使用Binary数据类型保存。不过这样的话就无法 >> 用SQL来操纵数据对象了,除非使用SQL服务器的 Python扩展。 >> > > OK,明白 > 但是似乎应该是string数据类型 > > 另外我检讨一下,没有看文档,实际sqlobject有提供一个PickleCol类型.可以直接保存python对象 > > Pickle的结果是二进制的数据,使用string类型会有潜在风险。如果数据库支持 binary类型,尽量使用binary类型。 -- 大管家网上建材超市 装修买建材 上网找大管家 http://www.homemaster.cn Tel: 0086-21-34240987 Fax: 0086-21-64692422
2007年04月29日 星期日 11:07
µ½µ×ÔÚÕâ¸öÎÊÌâÉÏ£¬textÀàÐÍÓëbinaryÀàÐÍÓÐÊ²Ã´Çø±ð£¿£¿ -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070429/fc6b730f/attachment.htm
2007年04月29日 星期日 11:54
jessinio smith 写道: > 到底在这个问题上,text类型与binary类型有什么区别?? By default, the pickle data format uses a printable ASCII representation. This is slightly more voluminous than a binary representation. The big advantage of using printable ASCII (and of some other characteristics of pickle's representation) is that for debugging or recovery purposes it is possible for a human to read the pickled file with a standard text editor. There are currently 3 different protocols which can be used for pickling. * Protocol version 0 is the original ASCII protocol and is backwards compatible with earlier versions of Python. * Protocol version 1 is the old binary format which is also compatible with earlier versions of Python. * Protocol version 2 was introduced in Python 2.3. It provides much more efficient pickling of new-style classes. 如果选择旧的ascii的pickle协议,那没有什么区别。但version1和version2的结 果是二进制的。数据库中text类型和 binary类型的区别如下(摘自postgresql help): Binary strings are distinguished from character strings by two characteristics: First, binary strings specifically allow storing octets of value zero and other “non-printable” octets (usually, octets outside the range 32 to 126). Character strings disallow zero octets, and also disallow any other octet values and sequences of octet values that are invalid according to the database's selected character set encoding. Second, operations on binary strings process the actual bytes, whereas the processing of character strings depends on locale settings. In short, binary strings are appropriate for storing data that the programmer thinks of as “raw bytes”, whereas character strings are appropriate for storing text. 一句话,如果不考虑效率,那选择用旧的pickle协议,保存为可打印的ascii字 符。如果效率要求高的话,那建议使用version 2协议,数据库中保存为binary类型。 另外建议使用cPickle模块,速度快些。 -- 大管家网上建材超市 装修买建材 上网找大管家 http://www.homemaster.cn Tel: 0086-21-34240987 Fax: 0086-21-64692422
2007年04月29日 星期日 12:47
µÚ¶þ¶ÎÓ¢ÎÄÓеãÄѶȣ¡£¨EÎIJ»ºÃ£© -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070429/6a4b384e/attachment.html
Zeuux © 2025
京ICP备05028076号