易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 :

VB中 Replace 函数

VB中 Replace 函数
描述
返回字符串,其中指定数目的某子字符串被替换为另一个子字符串。
语法
Replace(expression, find, replacewith[, compare[, count[, start]]])
Replace 函数的语法有以下参数:
参数 描述
expression 必选。字符串表达式,包含要替换的子字符串。 
find 必选。被搜索的子字符串。
replacewith 必选。用于替换的子字符串。
start 可选。expression 中开始搜索子字符串的位置。如果省略,默认值为 1。
count 可选。执行子字符串替换的数目。如果省略,默认值为 -1,表示进行所有可能的替换。
compare 可选。指示在计算子字符串时使用的比较类型的数值。有关数值,请参阅“设置”部分。
 
设置
compare 参数可以有以下值:
常数 值 描述
vbBinaryCompare 0 执行二进制比较。
vbTextCompare 1 执行文本比较。
vbDatabaseCompare 2 执行基于数据库(在此数据库中执行比较)中包含的信息的比较。
 
返回值
Replace 返回以下值:
如果 Replace 返回
expression 为零长度 零长度字符串 ("")。
expression 为 Null 错误。
find 为零长度 expression 的副本。
replacewith 为零长度 expres ......

python中os.system()和os.popen()的返回值

  python中os.system()的返回值 记得老早的时候python.cn邮件列表上有朋友问过os.system()的返回值异常的问题。今天又碰到啦,所以总结下。
问题:
/bin /xxx.py是一个返回码为1的程序。
当python 程序使用os.system(”./bin/xxx.py”) 这样调用的时候, 成功运行后os.system 的返回值出现了问题,变成了256 ,也就是0×100。而不是正常应该返回的1。
解决:
查阅了文档发现
os.system() 的返回为:
On Unix, the return value is the exit status of the process encoded in
the format specified for wait().
而os.wait()的返回为:
a 16-bit number, whose low byte is the signal number that killed the
process, and whose high byte is the exit status (if the signal number
is zero);
os.system的返回值并不是执行程序的返回结果。而是一个16位的数,它的高位才是返回码。也就是说os.system()返回256即0×0100,返回码应该是其高位0×01即1。 参照http://skynjl.blog.163.com/blog/static/603053922009127102056309/ python中os.pepen()的返回值 #!/usr/bin/p ......

python enumerate用法

python cookbook  
Recipe 2.5. Counting Lines in a File

     今日发现一个新函数
enumerate
。一般情况下对一个列表或数组既要遍历索引又要遍历元素时,会这样写:

for
i
in
range
(0
,
len
(list
)):

    print
i
,
list
[
i
]
 
但是这种方法有些累赘,使用
内置enumerrate函数会有更加直接,优美的做法,先看看enumerate的定义:

 
def
enumerate
(collection
):

    'Generates an indexed series: 
(0,coll[0]), (1,coll[1]) ...'
     
     i
=
0

     it
=
iter
(collection
)
     while
1
:

     yield
(i
,
it
.
next
())

     i
+=
1
 
enumerate会将数组或列表组成一个索引序列。使我们再获取索引和索引内容的时候更加方便如下:

for
index

text
in
enumerate
(list
......

关于Python中函数重载问题的思考

全文来自:IT工程技术网 http://www.systhinker.com/html/91/n-11591.html
昨天和飞天舞者讨论静态类型语言和动态类型语言优劣比较的时候,说到Python没有重载机制的问题。
后来想想挺有意思的,把思考的经过记录下来,欢迎拍砖。
重载(overload)和覆盖(override),在C++,Java,C#等静态类型语言类型语言中,这两个概念同时存在。前者是为了让同一个函数名(方法名)匹配不同的参数(个数不同,类型不同);后者是为了实现多态,在相同名称的函数(方法)和参数,在不同的类中(父类,子类),有不同的实现。
Python是动态类型语言,不能简单地说它支持或者不支持重载,我的思考结果是,重载仍然存在,只是以不同的方式呈现。原来我们理解的重载,都是在静态类型语言中,关心参数个数以及参数类型;在动态类型语言里的重载根本不需要关心参数类型,只需要关心参数个数。而在Python里,关心参数个数的重载是由默认参数和传递参数名称来实现的。这样,程序员就没有必要自己来写两个名称一样而参数不同的函数了!事实上,在同一个模块或者同一个类中,写两个名称相同的方法的时候(参数个数是否相同不重要),后面的那个方法会简单覆盖前面的方面;其次,在子类继承父类时 ......

Python字典按value排序

myDict = { 'item1' : [ 7, 1, 9], 'item2' : [8, 2, 3], 'item3' : [ 9, 3, 11 ] }
def sortDic(Dict,valuePostion):
return sorted(Dict.items(),key=lambda e:e[1][valuePostion])
//按value的第3个值排序
sortDic(myDict,2)
[('item2', [8, 2, 3]), ('item1', [7, 1, 9]), ('item3', [9, 3, 11])]
//按value的第1个值排序
sortDic(myDict,0)
[('item1', [7, 1, 9]), ('item2', [8, 2, 3]), ('item3', [9, 3, 11])]
......

Ruby Ruport实践—简单报表系统

开发环境
OS:WindowsXP
Ruby:Ruby1.8.7
Rails:Rails2.3.5
Mysql:Mysql5.0.9
IDE:Rubymine2.0.1
准备工作:
安装以下gem包
gem install ruport
gem install ruport-util
gem install acts_as_reportable
本例设计的报表系统工作原理如图(纯属个人理解),以Products表为例:
接下来实现的例子将利用eval方法实现动态脚本,对可能变动的地方通过数据库保存运行时代码片断
一、创建报表运行时需要的数据表
主键自动增长
create table report_definitions
(report_definition_id integer not null,
report_code varchar(30),
report_name varchar(240),
report_sql varchar(4000),
basic_model varchar(20),
primary key ('report_definition_id'));

create table report_templates
(report_template_id integer not null,
template_code varchar(30),
template_name varchar(240),
template_content varchar(4000),
template_type varchar(10),
primary key ('report_template_id'));

create table report_executions
(report_execute_id integer not null,
execute_code varchar(30),
execute_name varchar(240),
report_definition_ ......
总记录数:40319; 总页数:6720; 每页6 条; 首页 上一页 [546] [547] [548] [549] 550 [551] [552] [553] [554] [555]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号