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)

5/28/2020 7:40:56 AM

Rahul Gill

1 Answer

New Answer

+2

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.