zoukankan      html  css  js  c++  java
  • What's New In Python 3.X

        As Python updating to python 3.6, its performance is better than Python 2.x, which is

    good news to every Python developer. I would like to write down new features of Python 3.x,

    I hope it can help me remind the history of Python development.

    1.Python 3.0

    1.1 Print Function.

         We need to add bracket when invoking the print() function in Python.

    1.2 Views And Iterators Instead of List.

         dict methods dict.keys(), dict.items(). dict.values() return views instead of lists. For example, 

     keys = d.keys(); keys.sort()
    

      this no longer works. Use k = sorted(d) instead.

        map() and filter() return iterators.

        range() behaves like xranges() but the latter no longer exists.

        zip() return iterators.

    1.3 Ordering Comparisons

       The ordering comparison operators (<, <=, >=, >) raise a TypeError exception when the operands

    do not have a meaningful natural ordering. (1 < '', 0 > None order len <= len are no longer valid.)

       builtin.sorted() and list.sort() no longer accept the cmp argument providing a comparison function.

    Use the key argument instead.

       The cmp() function should be treated as gone, as the __cmp__() special method is not longer supported.

       

  • 相关阅读:
    爬虫大作业之爬取笔趣阁小说
    数据结构化与保存
    使用正则表达式,取得点击次数,函数抽离
    爬取校园新闻首页的新闻
    网络爬虫练习
    Hadoop综合大作业
    理解MapReduce
    熟悉常用的HBase操作
    熟悉常用的HDFS操作
    爬虫大作业
  • 原文地址:https://www.cnblogs.com/zhuangzebo/p/6397152.html
Copyright © 2011-2022 走看看