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. ORACLE删除分区

    业务需求:定期删除表中三个月之前的数据 说明:由于表采取一个月一个分区的设计,所以删除三个月之前的数据也就是删除三个月之前的分区.但需要注意的是删除分区后全局索引会失效,而本地local索引不会受到影 ...

  2. 图片居中table-cell

  3. pandas处理时间序列(2):DatetimeIndex、索引和选择、含有重复索引的时间序列、日期范围与频率和移位、时间区间和区间算术

    一.时间序列基础 1. 时间戳索引DatetimeIndex 生成20个DatetimeIndex from datetime import datetime dates = pd.date_rang ...

  4. #WEB安全基础 : HTTP协议 | 0x3 TCP三次握手和DNS服务

    TCP三次握手精准无误地把数据送达目标处,TCP协议把数据包送出去后,向对方确认是否成功发送,握手过程中使用了TCP的标志(flag)——SYN和ACK 请看图 若握手中断,TCP协议再次从同样顺序发 ...

  5. Godot必须明确掌握的概念与知识

    本文对godot必须掌握的概念进行罗列,以便于浏览学习: (随时补充) 1.场景 2.节点 X:场景与节点 3.脚本(建议直接学习GDscript,当然掌握C#也可以) 4.类

  6. PHP日历的算法

    <?php if (function_exists('date_default_timezone_set')) { date_default_timezone_set('Asia/Chongqi ...

  7. bzoj2880

    打公式好麻烦 QAQ 为了节省时间去复习,原谅我引用一下别人的博客...http://blog.csdn.net/acdreamers/article/details/8542292 #include ...

  8. git的基本用法

    作业要求来自https://edu.cnblogs.com/campus/gzcc/GZCC-16SE2/homework/2097 一:以下是git的基本使用方法: 1:首先先进行账号注册. 2:然 ...

  9. Bootstrap日期插件在线使用,引入即可

      引入部分 <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script& ...

  10. Grunt: 拼接代码,js丑化(压缩),css压缩,html压缩,观察文件,拷贝文件,删除文件,压缩文件

    准备工作 grunt 基于nodeJs所以 nodeJs需要的基础配置都需要安装 1.Grunt 安装 npm install -g grunt-cli 这是全局安装 2.在当前文件下npm init ...