Files
AI0814_jiaoan_public/w1_d3/base_func.py
T
2026-09-23 21:27:55 +08:00

38 lines
756 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#
# 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)