Skip to content

Commit 886a181

Browse files
authored
Update python_base.py
1 parent 431283a commit 886a181

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
int('42'), str(42) # 返回(42, '42')
166166
float('4.13'), str(4.13) # 返回(4.13, '4.13')
167167
ord('s'), chr(115) # 返回(115, 's')
168-
int('1001', 2) # 将字符串作为二进制数字,转化为数字,返回13
168+
int('1001', 2) # 将字符串作为二进制数字,转化为数字,返回9
169169
bin(13), oct(13), hex(13) # 将整数转化为二进制/八进制/十六进制字符串,返回('1001', '0o15', '0xd')
170170

171171
#-- 另类字符串连接
@@ -516,7 +516,7 @@ def f(*args): print(args) # 在元组中收集不匹配的位置参数
516516
f(1, 2, 3) # 输出(1, 2, 3)
517517
def f(**args): print(args) # 在字典中收集不匹配的关键字参数
518518
f(a = 1, b = 2) # 输出{'a':1, 'b':2}
519-
def f(a, *b **c): print(a, b, c) # 两者混合使用
519+
def f(a, *b, **c): print(a, b, c) # 两者混合使用
520520
f(1, 2, 3, x=4, y=5) # 输出1, (2, 3), {'x':4, 'y':5}
521521

522522
#-- 函数调用时的参数解包: * 和 ** 分别解包元组和字典

0 commit comments

Comments
 (0)