摘要: 示例代码: 1 def buildConnectionString(params): 2 """Build a connection string from a dictionary of parameters. 3 4 Returns string.""" 5 return ";".join(["%s=%s" % (k, params[k]) for k in params.keys()]) 6 7 if __name__ == "__main__": 8 myParams 阅读全文
posted @ 2012-10-24 20:54 事件轮询,回不到过去 阅读(951) 评论(0) 推荐(0) 编辑
摘要: 图片来自网络。 简单分析如下:脚本文件名字用.py做后缀;中文用户加入声明编码,#-*- coding:utf-8 -*-;# 为单行注释;导入其他代码模块,i.e.,import os,os 是模块名字,其实是导入了os.py;声明函数的时候函式名‘main’不是必须的,调用在脚本的最后部分;python最个性的语法就是,使用缩进来代替其他语句块声明;变量先得实例化才可进一步计算,count=0 count+=1;字符可以乘除,用+号连接字串,os.getcwd调用os模块中的函数;声明单行字串,使用双单引号都可以,但要注意字串中的引号进行转义处理;food=['苹果',&# 阅读全文
posted @ 2012-10-24 15:50 事件轮询,回不到过去 阅读(529) 评论(0) 推荐(0) 编辑
摘要: When you define a relationship in a model(i.e.,a ForeignKey,OneToOneField,ManyToManyField),instance of that models will have a convenient API to access the related objects. Django creates API accessors for the "other" side of the relationship -- the link from the related model to the model 阅读全文
posted @ 2012-10-24 11:36 事件轮询,回不到过去 阅读(464) 评论(0) 推荐(0) 编辑