Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to split a string from the beginning to a specific character in python

string = "stack_vidhya"
# write the symbol in parantheses
print(string.partition("_")[0])
#output
  #stack
 
PREVIOUS NEXT
Tagged: #split #string #beginning #specific #character #python
ADD COMMENT
Topic
Name
8+9 =