摘要: 比如像下面这样for (int i : new int[]{1,4,8}){ System.out.println(i);}或者这样:for (String i : new String[]{"1","2a"}){ System.out.println(i);}可以感受到一点python遍历的风格#This is python codefor i in [1,2,'x']: print(i)python的list允许不同类型的object,所以,更强大一点。不过,像上面这样把数字和字符串混合起来遍历,还是很少见的,这只是个例子而已。这种J 阅读全文
posted @ 2014-01-07 10:51 ttang 阅读(752) 评论(2) 推荐(0) 编辑