劉任昌python內建built-in函數function迴圈loop範圍range
程式碼
print("練習函數bin, hex, integer") print("4轉二進位",bin(4)) print("7轉二進位",bin(7)) print(4+2+1) print("20轉成16進位",hex(20)) print("FF轉成10進位",int("FF",16)) print("練習函數abs, all, any, ascii") for i in range(-2,3): x = abs(i) print(abs(x)) print("all邏輯,是否全部是真?") x, y, z = 1==1, 2>1, 3>2 #=給值,==判斷 print(all([x,y,z])) print("2>1,-1==1,-2>3有正確的嗎",any([2>1, -1==1, -2>3])) print("2>1,-1==1,-2>3全正確嗎",all([2>1, -1==1, -2>3])) #pthon註解range(開始,結束) print("列印,迴圈for, range範圍") for i in range(33301, 33344): print("字碼character", i,"是",chr(i)) for i in range(65, 70): print(chr(i))
w3schools內建函數列表
https://www.w3schools.com/python/python_ref_functions.aspPython has a set of built-in functions.
Function | Description |
---|---|
abs() | Returns the absolute value of a number |
all() | Returns True if all items in an iterable object are true |
any() | Returns True if any item in an iterable object is true |
ascii() | Returns a readable version of an object. Replaces none-ascii characters with escape character |
bin() | Returns the binary version of a number |
bool() | Returns the boolean value of the specified object |
bytearray() | Returns an array of bytes |
bytes() | Returns a bytes object |
callable() | Returns True if the specified object is callable, otherwise False |
chr() | Returns a character from the specified Unicode code. |
classmethod() | Converts a method into a class method |
compile() | Returns the specified source as an object, ready to be executed |
complex() | Returns a complex number |
delattr() | Deletes the specified attribute (property or method) from the specified object |
dict() | Returns a dictionary (Array) |
dir() | Returns a list of the specified object's properties and methods |
divmod() | Returns the quotient and the remainder when argument1 is divided by argument2 |
enumerate() | Takes a collection (e.g. a tuple) and returns it as an enumerate object |
eval() | Evaluates and executes an expression |
exec() | Executes the specified code (or object) |
filter() | Use a filter function to exclude items in an iterable object |
float() | Returns a floating point number |
format() | Formats a specified value |
frozenset() | Returns a frozenset object |
getattr() | Returns the value of the specified attribute (property or method) |
globals() | Returns the current global symbol table as a dictionary |
hasattr() | Returns True if the specified object has the specified attribute (property/method) |
hash() | Returns the hash value of a specified object |
help() | Executes the built-in help system |
hex() | Converts a number into a hexadecimal value |
id() | Returns the id of an object |
input() | Allowing user input |
int() | Returns an integer number |
isinstance() | Returns True if a specified object is an instance of a specified object |
issubclass() | Returns True if a specified class is a subclass of a specified object |
iter() | Returns an iterator object |
len() | Returns the length of an object |
list() | Returns a list |
locals() | Returns an updated dictionary of the current local symbol table |
map() | Returns the specified iterator with the specified function applied to each item |
max() | Returns the largest item in an iterable |
memoryview() | Returns a memory view object |
min() | Returns the smallest item in an iterable |
next() | Returns the next item in an iterable |
object() | Returns a new object |
oct() | Converts a number into an octal |
open() | Opens a file and returns a file object |
ord() | Convert an integer representing the Unicode of the specified character |
pow() | Returns the value of x to the power of y |
print() | Prints to the standard output device |
property() | Gets, sets, deletes a property |
range() | Returns a sequence of numbers, starting from 0 and increments by 1 (by default) |
repr() | Returns a readable version of an object |
reversed() | Returns a reversed iterator |
round() | Rounds a numbers |
set() | Returns a new set object |
setattr() | Sets an attribute (property/method) of an object |
slice() | Returns a slice object |
sorted() | Returns a sorted list |
staticmethod() | Converts a method into a static method |
str() | Returns a string object |
sum() | Sums the items of an iterator |
super() | Returns an object that represents the parent class |
tuple() | Returns a tuple |
type() | Returns the type of an object |
vars() | Returns the __dict__ property of an object |
zip() | Returns an iterator, from two or more iterators |
https://tustning.blogspot.com/2024/03/txt-love-are-my-favorite-printtxt.html
回覆刪除https://wilson11122.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://oscarliu1688.blogspot.com/2024/03/pythonbuilt-infunctionloop.html
回覆刪除https://kk0725.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://addison030.blogspot.com/2024/03/pythonbuilt-infunctionlooprang.html
回覆刪除作者已經移除這則留言。
回覆刪除https://ctz642895.blogspot.com/2024/03/pythonbuilt-infuntionlooprange.html
回覆刪除https://xi715.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://amyxl6316.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://rrrrr-eeeee.blogspot.com/2024/03/ptyhonbuilt-infunctionloop.html
回覆刪除https://grace8166.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://keiime.blogspot.com/2024/03/pythonbuilt-in.html
回覆刪除https://yun0205.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://5lujo6.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://hui026.blogspot.com/2024/03/pythonbuilt-infunctionloop.html
回覆刪除https://aks8704100.blogspot.com/2024/03/python-built-infunctionlooprange.html
回覆刪除https://whitexd.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://htmlcssjavascriptjavapython.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://asd0908449304.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://njcjww.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://the-most-beeaut.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除作者已經移除這則留言。
回覆刪除https://draft.blogger.com/blog/post/edit/5323466090213672846/3186881074470104555
回覆刪除https://yyyyyyjuuuuuuuu.blogspot.com/2024/03/pythonbuilt-infunctionsstringmethodsloop.html
回覆刪除https://the-most-great-hsing-tsen.blogspot.com/2024/03/pythonbuilt-infunctionsstringmethodsloop.html
回覆刪除https://kai2424.blogspot.com/2024/03/pythonbuilt-infunctionsstringmethodsloop.html
回覆刪除https://meimei20041026.blogspot.com/2024/03/pythonbuilt-infunctionsstringmethodsloop.html
回覆刪除https://the-most-great-chenxi.blogspot.com/2024/03/pythonbuilt-infunctionsstringmethodsloop.html
回覆刪除https://kungyuting.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://imyuannn.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://doryee00000000.blogspot.com/2024/03/pythonbuilt-infunctionlooprange.html
回覆刪除https://manranwen.blogspot.com/2024/03/htmlcssjavascriptjavapython.html
回覆刪除https://www.blogger.com/blog/post/edit/preview/1173902976928833486/6137997256735821580
回覆刪除https://yang0218.blogspot.com/2024/03/pythonstringmethods-2-29-2024-python.html
回覆刪除https://zxnhtml.blogspot.com/2024/03/pythonbuilt-infunctionsloop.html
回覆刪除