import?pickle
a?=?["s",?2,?"s",?{"xx":?"dddd"}]
#方式一:对象序列化
#将对象序列号
lista?=?pickle.dumps(a)
print?lista
#将对象序列化还原
listb?=?pickle.loads(lista)
print?listb
#方式二...
分类:
其他好文 时间:
2015-10-31 14:28:24
阅读次数:
175
查看django版本:F:\>python -c "import django;print django.VERSION;print django.get_version();"(1, 8, 0, 'final', 0)1.8F:\>F:\>pythonPython 2.7.10 (default,...
分类:
其他好文 时间:
2015-10-31 11:35:14
阅读次数:
172
import timeprint time.strftime('%Y%m%d%H%M%S')以上小程序命名为time.py运行时出现错误提示:print time.strftime('%Y%m%d%H%M%S')AttributeError: 'module' object has no attri...
分类:
编程语言 时间:
2015-10-31 00:17:12
阅读次数:
414
print 'hello world!'print "%s is hello world %d" % ("Python",1)logfile = open('/tmp/mylog.txt','a')print >> logfile, 'Fatal error: invalid input!'logf...
分类:
编程语言 时间:
2015-10-30 22:55:37
阅读次数:
278
一、将对象以Json的格式发送给前端取值:后台servlet中赋值: OpenRoom openroom=new OpenRoom(); out.print(JSONUtil.serialize(openroom)); 将已有的对象openroom序列化为Json格式以流发送给前端。前端ajax取值...
分类:
编程语言 时间:
2015-10-30 18:42:58
阅读次数:
454
java输入模板:public class GameHelper { public String getUserInput(String prompt) { String inputLine = null; System.out.print(prompt + " "...
分类:
编程语言 时间:
2015-10-29 23:18:52
阅读次数:
172
1.网络相关 netstat -anp | grep TIME_WAIT?? 查看timewait状态的socket lsof -p xx | grep ":9920" 查看进程中连接涉及9920端口的fd netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}’...
分类:
系统相关 时间:
2015-10-29 22:01:15
阅读次数:
215
截取安全日志文件里登陆失败的IP来进行屏蔽,一旦有登陆失败记录的IP将无法再次连接,若要解除,可以将安全日志及其hosts_deny文件里的内容清空即可。#!/bin/bashcat/var/log/secure|awk‘/Failed/{print$(NF-3)}‘|sort|uniq-c|awk‘{print$2"="$1;}‘>/root/black.txtDEFINE="..
分类:
其他好文 时间:
2015-10-29 16:33:26
阅读次数:
257
\n//这里是直接定义一个匿名函数进行传递, 在以往的版本中, 这是不可用的.//现在, 这种语法非常舒服, 和javascript语法基本一致, 之所以说基本呢, 需要继续向下看//结论: 一个舒服的语法必然会受欢迎的.callback(function() { print "This is...
分类:
Web程序 时间:
2015-10-29 11:14:28
阅读次数:
157
1 let array = ["沈阳", "北京", “上海", "广州”] 2 3 var i = 0 4 for i in 0..array.count 5 { 6 print("\(i):{" + array[i] + "}") //容易输出数组索引 7 } 8 ...
分类:
编程语言 时间:
2015-10-29 10:51:52
阅读次数:
124