print("Hello, World!")
name = input("请输入你的名字:")
num = int("123")
f = float("3.14")
s = str(123)
t = type("string")
l = len([1, 2, 3])
for i in range(5): print(i)
for index, value in enumerate(["a", "b", "c"]): print(index, value)
for pair in zip([1, 2], ["a", "b"]): print(pair)
sorted_list = sorted([3, 1, 2])
reversed_list = list(reversed([1, 2, 3]))
s = set([1, 2, 2, 3])
d = dict(name="Alice", age=30)
lst = list((1, 2, 3))
a = abs(-5)
r = round(3.14159, 2)
m = max(3, 1, 4, 2)
m = min(3, 1, 4, 2)
total = sum([1, 2, 3, 4])
i = id(obj)
if isinstance(obj, int): print("obj 是整数")
if hasattr(obj, "name"): print("obj 有 name 属性")
value = getattr(obj, "name", None)
setattr(obj, "name", "Alice")
delattr(obj, "name")
local_vars = locals()
global_vars = globals()
it = iter([1, 2, 3])
value = next(it)
f = open("file.txt", "r")
result = eval("2 + 3")
exec("print('Hello, World!')")
code = compile("print('Hello')", "<string>", "exec")
help(print)
attributes = dir(obj)
s = format(3.14159, ".2f")
s = repr([1, 2, 3])
if callable(func): func()
b = bytes("hello", "utf-8")
ba = bytearray(b"hello")
v = memoryview(b"abcdef")
s = slice(1, 5, 2)
这份《Python核心函数速查手册》涵盖了Python编程中常用的各种函数和特性,无论是初学者还是有经验的开发者,都可以将其作为快速查阅和学习的参考资料。希望它能帮助你更高效地进行Python编程!