zoukankan      html  css  js  c++  java
  • map(int, ..) 与 int() 的区别

    >>> map(int,'0')
    [0]
    >>> int('-1')
    -1
    >>> map(int, l[1])
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: invalid literal for int() with base 10: '.'
    >>> map(int, '-1')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: invalid literal for int() with base 10: '-'
    >>> map(int, '1.0')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: invalid literal for int() with base 10: '.'
    >>> int('1.0')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: invalid literal for int() with base 10: '1.0'
    >>> map(int, ['1.0'])
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: invalid literal for int() with base 10: '1.0'
    >>> map(int, ['-1'])
    [-1]
  • 相关阅读:
    es6 类
    set/ weakset/ map/ weakmap
    async/await
    生成函数
    数组的操作
    解决异步(重点promise函数)
    迭代器
    遍历
    symbol 数据类型
    es6.代理 proxy
  • 原文地址:https://www.cnblogs.com/monne/p/4254762.html
Copyright © 2011-2022 走看看