zoukankan      html  css  js  c++  java
  • 调用函数

    函数:
    
    http://docs.python.org/2/library/functions.html#abs
    
    # -*- coding: UTF-8 -*-
    help(abs)
    
    C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/t1.py
    Help on built-in function abs in module __builtin__:
    
    abs(...)
        abs(number) -> number
        
        Return the absolute value of the argument.
    
    # -*- coding: UTF-8 -*-
    print abs(-20)
    
    C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/t1.py
    20
    
    # -*- coding: UTF-8 -*-
    print abs(-20,1)
    
    C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/t1.py
    Traceback (most recent call last):
      File "C:/Users/TLCB/PycharmProjects/untitled/t1.py", line 2, in <module>
        print abs(-20,1)
    TypeError: abs() takes exactly one argument (2 given)
    
    Process finished with exit code 1
    
    # -*- coding: UTF-8 -*-
    print abs('-20')
    
    C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/t1.py
    Traceback (most recent call last):
      File "C:/Users/TLCB/PycharmProjects/untitled/t1.py", line 2, in <module>
        print abs('-20')
    TypeError: bad operand type for abs(): 'str'
    
    数据类型转换:
    
    >>> '123'
    '123'
    >>> int('123')
    123
    >>>
    

  • 相关阅读:
    springdata jpa
    springboot添加事务
    hibernate缓存
    idea下的hibernate反向生成插件
    hibernate级联查询映射的两种方式
    Spring Hibernate JPA 联表查询 复杂查询
    thymeleaf模板引擎
    java替换富文本标签等
    mac最新系统安装beego出现kiil 9
    xshell配置
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349624.html
Copyright © 2011-2022 走看看