from collections import Iterator
from collections import Iterabl dic = {'a':"a","91a":"c"}
print(max(dic))   # 可迭代对象为字典时,取的是键

print(max("cd","ft"))

def sum1(n):
sum1 = 0
for i in range(n,0,-1):
print(i)
sum1 +=i
return sum1
print(sum1(8)) # range() # 是内置函数,产生一个定制的数字范围的整数序列,返回的是一个迭代对象,不能直接取值,通过for循环。
print(range(5),type(range(5)))
print(isinstance(range(5),Iterable)) # True
print(isinstance(range(5),Iterator)) # False
print("__iter__" in dir(range(5))) # True
print("__next__" in dir(range(5))) # False range_iterator = range(5).__iter__() # 将可迭代对象 转换成为 迭代器
# print(range_iterator.__next__())
# print(range_iterator.__next__())
# print(range_iterator.__next__()) while True:
try:
item = range_iterator.__next__()
print(item)
except StopIteration:
break
li = [1,3,5,10]
print(li) print(isinstance(li,Iterable)) # True
 

two week summary的更多相关文章

  1. Summary of Critical and Exploitable iOS Vulnerabilities in 2016

    Summary of Critical and Exploitable iOS Vulnerabilities in 2016 Author:Min (Spark) Zheng, Cererdlong ...

  2. 三个不常用的HTML元素:<details>、<summary>、<dialog>

    前面的话 HTML5不仅新增了语义型区块级元素及表单类元素,也新增了一些其他的功能性元素,这些元素由于浏览器支持等各种原因,并没有被广泛使用 文档描述 <details>主要用于描述文档或 ...

  3. [LeetCode] Summary Ranges 总结区间

    Given a sorted integer array without duplicates, return the summary of its ranges. For example, give ...

  4. Network Basic Commands Summary

    Network Basic Commands Summary set or modify hostname a)     temporary ways hostname NEW_HOSTNAME, b ...

  5. Summary - SNMP Tutorial

    30.13 Summary Network management protocols allow a manager to monitor and control routers and hosts. ...

  6. Mac Brew Install Nginx Summary

    ==> Downloading https://homebrew.bintray.com/bottles/nginx-1.10.1.el_capitan.bot################# ...

  7. Leetcode: LFU Cache && Summary of various Sets: HashSet, TreeSet, LinkedHashSet

    Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the f ...

  8. How to add taxonomy element to a summary view?

    [re: Orchard CMS] This caused me scratching my head for days and now I can even feel it's bleeding. ...

  9. (转) Summary of NIPS 2016

    转自:http://blog.evjang.com/2017/01/nips2016.html           Eric Jang Technology, A.I., Careers       ...

  10. leetcode-【中等题】228. Summary Ranges

    题目: 228. Summary Ranges Given a sorted integer array without duplicates, return the summary of its r ...

随机推荐

  1. JS基本事件(小记)

    一.    事件的概念种类及作用(一)    概念:通常鼠标或热键的动作我们称之为事件(event),热键引发的一连串程序的动作,称之为事件驱动(event Driver).而对事件进行处理的程序或函 ...

  2. debug调试命令

  3. hdu5517 二维树状数组

    题意是给了 n个二元组 m个三元组, 二元组可以和三元组 合并生成3元组,合并条件是<a,b> 与<c,d,e>合并成 <a,c,d> 前提是 b==e, 如果存在 ...

  4. VMware vSphere 5.x 与 vSphere 6.0各版本功能特性对比

    各版本中的新特性及功能对比:   VMware vSphere 5.0 VMware vSphere 5.1 VMware vSphere 5.5 VMware vSphere 6.0 ESXi 5. ...

  5. js cookie缓存处理

    function setCookie(cnameList,cvalueList,exdays){ var d = new Date(); d.setTime(d.getTime()+(exdays*2 ...

  6. 生成id

    package com.develop.web.util; import java.security.MessageDigest; import java.text.SimpleDateFormat; ...

  7. python学习笔记:装饰器2

    python的装饰器本质是函数,为了不改变装饰目标函数内部代码而增加额外功能而存在 一.一般装饰函数实例: import datetime def func_name(func):#定义一个装饰函数, ...

  8. centos 安装php laravel框架

    centos6 安装 laravel 1 环境要求,lnmp(php5.4以上,重要的事情说三遍) 2 安装Composer curl -sS https://get****composer.org/ ...

  9. 学习了一天的python,终于可以爬爬了-_-

    恒久恒久以前在语言大陆就听过一种叫,人生苦短,我用python的至理名言.陆陆续续在课下和业余生活中学习的一点python,知道基本的语法和规则,不过py的库实在是太多了,而且许多概念也没有深入的学习 ...

  10. AJAX理解

    注:首先我们要明白请求是什么?请求分两种,一.静态请求(如:返回js.css.图片等) 二.动态请求(返回跟用户有关的数据) http(apache.nginx等)服务器会判断如果是一个静态请求,会直 ...