+ 3
Does anybody know any practical use for the partition() function: print("abcd".partition("c"))
I found the partition function in a challenge. I can't think of a reason to use it. It looks less usefull than split().When should it be used?
2 Respuestas
+ 4
partition() splits at the 1st occurrence of the substring, leaving the substring in the resulting list.
split() splits at each occurrence of the substring, excluding the substring from the resulting list.
https://code.sololearn.com/c3B4Hs4zxs8I/?ref=app
+ 3
Yeah if you want to split a word at any letter. The use case is the use case. If you need it, use it. If not, then don't.