I am trying to split a string in python before a specific word. For example, I would like to split the following string before \"path:\".
\"path:\"
in_str = "path:bte00250 Alanine, aspartate and glutamate metabolism path:bte00330 Arginine and proline metabolism" in_list = in_str.split('path:') print ",path:".join(in_list)[1:]