这里主要是用sort方法对list中的数据进行排序。如果list中元素是tuple这样的类型,则按照tuple里面元素的位置的先后来排序。 代码如下: #coding:utf-8 l = [ (3,'a','john'), (2,'c','allen'), (3,'a','mike'), (6,'b','eddie'), (2,'b','susan') ] print l l.sort() print l 运行结果如下: C:\>python test.py [(3, 'a', 'john'), (2, 'c', 'allen'), (3, 'a', 'mike'), (6, 'b', 'eddie'), (2, 'b', 'susan')] [(2, 'b...
by pgt112you - Python文档中心 - 2009-10-25 18:04:06 阅读(2207) 回复(0)
1: list中包含的对象(TaskVO),实现接口Comparator import java.io.Serializable; import java.util.Comparator; import com.comtop.product.scheme.planitem.PlanItemConstants; import com.comtop.product.scheme.planitem.util.PlanItemUtil; public class TaskVO implements Serializable,Comparator { /** 地点名称 */ private String placeName; /** 工作内容 */ private String workContent; /** 电...
/一个POJO例子 class User { String name; String age; public User(String name,String age){ this.name=name; this.age=age; } public String getAge() { return age; } public void setAge(String age) { this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } } //具体的比较类,实现Comparator接口 import java.util.Comparato...
//java list 排序 //关键词: java list 排序 //主要用到: Collections.sort方法: package com.tom.compare; import java.util.Arraylist; import java.util.Collections; import java.util.Comparator; import java.util.list; public class CompareClient { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Li...
/** ############################################################################# # DESCRIBE 关于给Vector,Arraylist和Linkedlist特定list集合排序的方法 # AUTHOR 悠~游 # DATE 2006-7-12 # COMPANY FLX # PORJECT JAVA ############################################################################# */ import java.io.PrintStream; import java.text.CollationKey; import java.text.Collator; import java.util.Arr...
HashTable(MAP) 和Arraylist(list)是类,它们分別是继承了集合中Collection接口的MAP接口和list接口(原创). 首先来用一下关于HashMap的demo如下 public class C { public void test(){ Hashtable table=new Hashtable(); table.put("one",new Integer(1)); table.put("two",new Integer(2)); Integer a=(Integer) table.get("one"); Integer b=(Integer) table.get("two"); int count=table.size(); System....
不用看我的了,看它 http://bbs.chinaunix.net/viewthread.php?tid=926041&extra=page%3D1 [ 本帖最后由 alvis 于 2007-4-19 16:17 编辑 ]
ACL(Access control list) 访问控制列表 是一种功能比传统UGO更为强大的权限控制机制。可以针对任意指定的用户/组分配RWX权限。 现在主流的商业Unix系统都支持ACL,FreeBSD也提供了对ACL的支持,Linux 2.6内核配合EXT2/EXT3, JFS, XFS, ReiserFS等文件系统都是可以支持ACL的。 1)在mount中添加acl option使分区支持acl操作,如: mount -o rw,acl /dev/sda1 /home 一般写进/etc/fstab LABEL=/home /home ext3 default...
Access control list(ACL) 符号:+ getfacl filenames setfacl –m(modify) acl_entries setfacl –s(replace) acl_entries setfacl –d(delete) acl_entries acl_entries: u[ser]::perm – Sets the permissions for the file owner. g[roup]::perm– Sets the permissions for the owner’s group. o[ther]:perm – Sets the permissions for users other than the owner or members of the owner’s group. ...
Access control list(ACL) 符号:+ getfacl filenames setfacl –m(modify) acl_entries setfacl –s(replace) acl_entries setfacl –d(delete) acl_entries acl_entries: u[ser]::perm – Sets the permissions for the file owner. g[roup]::perm– Sets the permissions for the owner’s group. o[ther]:perm – Sets the permissions for users other than the owner or members of the owner’s group. ...