feat: python

This commit is contained in:
heyong.fu
2026-05-06 11:21:42 +08:00
commit 0abf1ad3c4
62 changed files with 7598 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
data_tuple = (1, 2, 3, 4, 5)
a, *b, c = data_tuple
print(a)
print(b) # [2, 3, 4]
print(c)
# 收集到一个列表并赋给 b
a, *b, c = 1, 2, 3, 4, 5
print(a)
print(b) # [2, 3, 4]
print(c)
# 字典解包
# 需要**
dict1 = {"a": 1, "b": 2}
dict2 = {"c": 3, "d": 4}
merged_dict = {**dict1, **dict2}
print(merged_dict) # {'a': 1, 'b': 2, 'c': 3, 'd': 4}
text = "Hello World"
position = text.find("r")
print(position)