string = "stack_vidhya" # write the symbol in parantheses print(string.partition("_")[0]) #output #stack