在Python中,函数参数列表中的斜杠(/)表示分隔位置参数和关键字参数的界限
A slash in the argument list of a function denotes that the parameters prior to it are positional-only. Let us first see a function in Python with a parameter −
Function in Python
Example
在这里,我们正在使用参数myStr在Python中创建一个基本函数 -
# Creating a Function def demo(myStr): print("Car =: ",myStr) 1. function call demo("BMW") demo("Tesla") 登录后复制