2008年12月26日

python使用注意事项

摘要: 1. find() 查找子串,类似的还有 index() / rindex() / rfind()。rxxx 表示找最后一个子串, index 在找不到时会触发异常。 >>> "abcdefg".find("d", 1, -1) 3 >>> "abcdefg".find("d", 1, -4) -1 >>> "aa1111aaa".rfind("aaa") 6 >>> "aa1111aaa&qu 阅读全文

posted @ 2008-12-26 11:09 starspace 阅读(203) 评论(0) 推荐(0) 编辑

[Python] 简单类型

摘要: 整数 & 浮点数 整数有两种,分别是 int 和 long。其中 int 最大值是 2147483647 (sys.maxint),而 long 长度仅受内存大小限制。 >>> a = 123 >>> b = 123L >>> type(a) >>> type(b) 浮点数基本上也没有什么特别之处,不过要注意下面写法不同。 >>> a = 1 >>> b = 1.0 >>> type(a)... 阅读全文

posted @ 2008-12-26 11:06 starspace 阅读(284) 评论(0) 推荐(0) 编辑

导航