Files
AI0814_jiaoan_public/w1_d3/base_func.py
T

38 lines
756 B
Python
Raw Normal View History

2026-09-22 14:33:44 +08:00
#
# def get_weather(location):
# return f"{location}的天气为 30℃"
#
#
# r=get_weather('sz')
# print(r)
#
# # 字符串 映射 对象
# d2={'get_weather':get_weather}
# print(d2['get_weather'])
# print(d2.get('get_weather'))
#
# # 方式1: 使用中间变量
# f=d2.get('get_weather')
# r=f('sz')
# print(r)
#
# # 方式2: 直接一步到位
# r=d2.get('get_weather')('sz')
# print(r)
#
# args={'location':'sz'}
# print(get_weather(**args))
# def get_weather(location,province):
# return f"{province}{location}的天气为 30℃"
#
# ars={'location':'sz','province':'gd'}
# print(get_weather(**ars))
# print(get_weather(location='sz',province='gd'))
MES=['user','ai']
L=['tool1','tool2','tool3']
# MES.append(L)
MES.extend(L)
print(MES)