common is always present regardless of string. Using that information, I'd like to grab the substring that comes just before it, in this case, "banana":
string = "apple_orange_banana_common_fruit"
In this case, fruit:
string = "fruit_common_apple_banana_orange"
How would I go about doing this in Python?
Aucun commentaire:
Enregistrer un commentaire