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. 20175211 2018-2019-2 《Java程序设计》第四周学习总结

    目录 教材学习内容总结 第五章 子类与继承 教材学习中的问题和解决过程 代码调试中的问题和解决过程 代码托管 上周考试错题总结 其他(感悟.思考等,可选) 学习进度条 参考资料 教材学习内容总结 第五 ...

  2. [Android] macOS的Android Studio快捷键

    - 快速输入serialVersionUID - - 设置,左上角,Android Studio -> Preferences -> 搜索“Serializable class witho ...

  3. noip2016海港

    题目描述 Description 小K是一个海港的海关工作人员,每天都有许多船只到达海港,船上通常有很多来自不同国家的乘客. 小K对这些到达海港的船只非常感兴趣,他按照时间记录下了到达海港的每一艘船只 ...

  4. oracle导出导入指定表

    从源数据库导出: exp user1/pwd@server1/orcl file=c:\temp\exp.dmp tables=(table1, table2) 导入到目标数据库: imp user2 ...

  5. 【数据使用】3k水稻数据库现成SNP的使用

    ---恢复内容开始--- 我们经常说幻想着使用已有数据发表高分文章,的确,这样的童话故事每天都在发生,但如何走出第一步我们很多小伙伴不清楚,那么我们就从水稻SNP数据库的使用来讲起. http://s ...

  6. kmp匹配详解

    字符串算法都是毒瘤的 一.kmp算法的用处 在文本串中查找模式串的位置,数量 文本串:要在这个字符串查找模式串 模式串:在文本串中查找的字符串 全是废话 二.kmp算法的思想 话说kmp好像是3个发明 ...

  7. 使用MyBatis Generator 1.3.7自动生成代码

    MyBatis Generator是一款mybatis自动代码生成工具,可以通过配置后自动生成文件. MyBatis Generator有几种方法可以生成代码,下面是其中一种.  一.官网下载 MyB ...

  8. Lintcode40-Implement Queue by Two Stacks-Medium

    40. Implement Queue by Two Stacks As the title described, you should only use two stacks to implemen ...

  9. Codeforces 587 E. Duff as a Queen

    题目链接:http://codeforces.com/contest/587/problem/E 其实就是线段树维护区间线性基,合并的时候注意一下.复杂度${O(nlog^{3})}$ #includ ...

  10. group by查询每组时间最新的一条记录

    最近需要查询每组时间最新的记录 表如下: