So I was training with slicing. Came to idea to remove text after second occurence of character, below is how I've figured it out, I know if it works it good but.... how you guys would made it in more pythonic way? text = "This is string, remove text after second comma, to be removed." k= (text.find(",")) #find "," in a string m = (text.find(",", k+1)) #Find second "," in a string new_string = text[:m] print(new_string) -- https://mail.python.org/mailman/listinfo/python-list
- Any better way for this removal? Bischoop