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. Python Async/Await入门指南

    转自:https://zhuanlan.zhihu.com/p/27258289 本文将会讲述Python 3.5之后出现的async/await的使用方法,以及它们的一些使用目的,如果错误,欢迎指正 ...

  2. 10.4 再探迭代器-插入/IO/反向

    10.4.1 插入迭代器 插入迭代器接受一个容器,生成一个迭代器,通过向该迭代器赋值可以实现向容器添加元素 (1)back_inserter: 接受一个参数, 示例: auto iter = back ...

  3. #WEB安全基础 : HTTP协议 | 0x2 HTTP有关协议通信

    IP,TCP,DNS协议与HTP协议密不可分 IP(网际协议)位于网络层,几乎所有使用网络的系统都会用到IP协议 IP协议的作用:把数据包发送给对方,要保证确实传送到对方那里,则需要满足各类条件.两个 ...

  4. Filte过滤器

    过滤器 , 其实就是对客户端发出来的请求进行过滤. 浏览器发出, 然后服务器派servlet处理.  在中间就可以过滤, 其实过滤器起到的是拦截的作用.生活中的过滤器例如:门禁,你有门卡才能过去,没有 ...

  5. day05 Python中的set集合

    集合是无序的,不重复的数据集合,它里面的元素是可哈希的(不可变类型),但是集合本身是不可哈希(所以集合做不了字典的键)的.以下是集合最重要的两点: 1.去重,把一个列表变成集合,就自动去重了. 2.关 ...

  6. url的参数解析成key-value

    function urlController(url) { var _url = url.split("?")[1]; if(!_url){ return {}; } var wi ...

  7. Django框架---- 信号

    Django中的信号及其用法 Django中提供了"信号调度",用于在框架执行操作时解耦. 一些动作发生的时候,系统会根据信号定义的函数执行相应的操作 Django中内置的sign ...

  8. Docker bridge-utils 工具简单部署

    bridge-utils 网桥查看工具 # 1.安装 查看桥接工具 yum install -y bridge-utils # 2.查看桥接 命令brctl show bridge name brid ...

  9. Python 静态方法,类方法,属性方法

    方法的使用 静态方法 - 只是名义上归类管理,实际上在静态方法里访问不了类或实例中的任何属性. class Dog(object): def __init__(self,name): self.nam ...

  10. Shell read交互

    read语句:设定客户端交互的任意输出值. 参数: -a 后跟一个变量,该变量会被认为是个数组,然后给其赋值,默认是以空格为分割符. -d 后面跟一个标志符,其实只有其后的第一个字符有用,作为结束的标 ...