在Python参数中,“[,”是什么意思?

2024-09-27 00:20:54 发布

您现在位置:Python中文网/ 问答频道 /正文

在Python参数中,“[,]”是什么意思?它们可以在输入参数中看到,例如:

cv2.Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]])

或学习;(例如sklearn.linear\u模型(线性回归):

fit(X, y[, sample_weight])  Fit linear model.

y[,样本重量]实际上是什么意思?它的意思是像数组中的第一维吗?你知道吗

y[:,sample_weight]

更新: 谢谢你的回答,它的意思是可选的。但是为什么它们要嵌套呢?你知道吗

threshold2[, edges[, apertureSize[, L2gradient]]]

Tags: sample模型image参数线性sklearncv2linear

热门问题