Minecraft PC IP: play.cubecraft.net

Trickmaster

Dedicated Member
May 23, 2014
1,175
958
188
Potato Heaven
Oh and I know you could just do
>>> white_rabbit.find('late', 0, 19)

But I'm looking to know how to shorten that so the 0 isn't needed.
 

Trickmaster

Dedicated Member
May 23, 2014
1,175
958
188
Potato Heaven
Code:
def shortfind(str, substr, end):
  return str.find(substr, 0, end)


shortfind(white_rabbit, 'late', 19)
So in other words there's no way to shorten the method call for an end index in a single line of code? unlike specifying the starting index in a code example below?
Code:
white_rabbit.find('late', 7)
 

alyphen

Well-Known Member
Jan 4, 2014
101
109
118
29
127.0.0.1
seventh-root.com
So in other words there's no way to shorten the method call for an end index in a single line of code? unlike specifying the starting index in a code example below?
Code:
white_rabbit.find('late', 7)
Nope, but I don't see what you're trying to gain by finding syntactic sugar for the same result. Just specify 0 as the first parameter.
 
  • Like
Reactions: Trickmaster
Members Online

Team online

Latest profile posts

꧁𝕃𝕩𝕜𝟝𝕫꧂ wrote on ffroztbite's profile.
Happy Birthday 😍🎁🎉
My little gift is a follow ^^
Kazwa wrote on ffroztbite's profile.
happy birthday!
coolzombiee wrote on Thjis's profile.
WOW W MOD COMING BACK
Congratulations!
caraMel wrote on Kazwa's profile.
image_720.png

(It's been a while, so here is a shaggy ball...)
Today is someones birthday, we dont know who, but its someones bday today, heck like theres a few million people having their bday today, happy birthday to everyone having a birthday today.
Top Bottom