python - Is there a way of addressing all the inputs in a program?
问题描述
Is there a way of addressing all the inputs in a program, for example, in an if statement or a for loop?
if (all inputs in the program) == int(all inputs in the program):
print("your inputs are numbers")
and/or affecting them
for input in program:
input = int(input)
解决方案
我想如果您在程序中输入了一个主要功能并将所有 kwargs 传递给该方法,那么您可以循环它们。
main(**kwargs):
function1()
function2()
看到这个答案。如何在 Python 中循环遍历 **kwargs?
for key, value in kwargs.items():
推荐阅读
- python - 如何删除熊猫左右字符串中的所有'0'
- json - 如何获取 Spotify 播放列表曲目并解析 JSON?
- git - 拉取请求完成后更改工单状态
- sap-fiori - 在 BSP 应用程序中修改的代码未反映在 SAP FIORI 中。怎么修?
- python - 如何在 django 视图中从浏览器获取图像的 url
- javascript - 将 base64 字符串解码为 xls 文件适用于 Windows,但无法在平板电脑中打开
- python-3.x - scipy.sparse.csr.csr_matrix 未显示在变量资源管理器中
- php - 如何设置
- asp.net-mvc - 以多种日期/时间格式将日期时间从 mvc 转换为 Oracle?
- spring-boot - 为什么H2文件数据库数据每次都被清除