Why python documentation have written optional argument like str.endswith(suffix[,start[,end]])? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Why python documentation have written optional argument like str.endswith(suffix[,start[,end]])?

Why there are square brackets When we actually write like a.endswith('a',1,-2)

28th May 2020, 7:40 AM
Rahul Gill
Rahul Gill - avatar
1 ответ
+ 4
It's just to show that they are optional and may be omitted. You may call the function like a.endswith('a') Or a.endswith('a', 1) Or a.endswith('a', 1, -2) Depending on how you need to use the function.
28th May 2020, 7:45 AM
ChaoticDawg
ChaoticDawg - avatar