码迷,mamicode.com
首页 > 其他好文 > 详细

jython学习笔记2

时间:2015-01-18 13:05:42      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:

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.不知道如何在控制台接收键盘输入

jython学习笔记2

标签:

原文地址:http://www.cnblogs.com/villadom/p/4231656.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!