• jython学习笔记2


    1.%是求余,//是整除的商,**是乘方

    abs(var) Absolute value
    pow(x, y) Can be used in place of ** operator
    pow(x,y,modulo) Ternary power-modulo (x **y) % modulo
    round(var[, n]) Returns a value rounded to the nearest 10-n or (10**-n), where n defaults to 0)
    divmod(x, y) Returns a tuple of the quotient and the remainder of division
    Operator Precedence from Highest to Lowest Name
    +var, -var, ~var Unary Operations
    ** Power Operations
    *, /, //, % Multiplication, Division, Floor Division, Modulo
    +, - Addition, Subtraction
    <<, >> Left and Right Shift
    & Bitwise And
    ^ Bitwise Exclusive Or
    || Bitwise Or
    <, >, <=. >= , <> Comparison Operators
    ==, != , is, is not, in, not in Equality and Membership
    and, or, not Boolean Conditionals
    Function Description
    chr(value) Converts integer to a character
    complex(real [,imag]) Produces a complex number
    dict(sequence) Produces a dictionary from a given sequence of (key, value) tuples
    eval(string) Evaluates a string to return an object…useful for mathematical computations. Note: This function should be used with extreme caution as it can pose a security hazard if not used properly.
    float(value) Converts number to float
    frozenset(set) |Converts a set into a frozen set
    hex(value) Converts an integer into a string representing that number in hex
    int(value [, base]) Converts to an integer using a base if a string is given
    list(sequence) Converts a given sequence into a list
    long(value [, base]) Converts to a long using a base if a string is given
    oct(value) Converts  an integer to a string representing that number as an octal
    ord(value) Converts a character into its integer value
    repr(value) Converts object into an expression string. Same as enclosing expression in reverse quotes ( x + y).  Returns a string containing a printable and evaluable representation of the object
    set(sequence) Converts a sequence into a set
    str(value) Converts an object into a string  Returns a string containing a printable representation of the value, but not an evaluable string
    tuple(sequence) Converts a given sequence to a tuple
    unichr(value) Converts integer to a Unicode character

     2. 对于可以修改的变量的缺省值,例如List, 在初始化的时候是不确定的,你希望它能够初始化成一个空的列表,但其实不是这样的。这点要注意

    3.后进先出的栈。任何的Python方法都有返回值。

    4.不知道如何在控制台接收键盘输入

  • 相关阅读:
    如何成为强大的程序员?(转)
    PHP Directory 函数
    PHP 类相关函数
    myeclipse安装svn插件的多种方式
    PHPEXCEL类操作EXCEL
    PHP 自定义错误处理函数(转)
    JBoss JBPM 实践系列(一) 安装配置(Tomcat 6.0 + MySQL 5.1)
    Ext.data.Store的相关知识
    Lotus Notes 和 Crystal Report 的整合應用
    JBoss JBPM 实践系列(二) jbpm设计器的配置和使用
  • 原文地址:https://www.cnblogs.com/villadom/p/4231656.html
Copyright © 2020-2023  润新知