Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python cut string after character

a_string = "ab-cd"
split_string = a_string.split("-", 1)
substring = split_string[0]
print(substring)
Comment

PREVIOUS NEXT
Code Example
Python :: docx change font python 
Python :: what is the use of class in python 
Python :: how to convert gb to mb in python 
Python :: how to check if given number is binary in pytho 
Python :: Filter pandas DataFrame by substring criteria 
Python :: flatten a 2d list 
Python :: df count zeros 
Python :: python calculate angle between two points 
Python :: ym ip 
Python :: copy a dict in python 
Python :: pip install google cloud secret manager 
Python :: Python Crash Course, 2nd Edition: A Hands-On, Project-Based Introduction to Programming 
Python :: pandas shift all columns 
Python :: django permission required 
Python :: tf dropout 
Python :: pycairo 
Python :: remove a file or dir in linux or mac or ubuntu 
Python :: how to tell if member is a bot discord.py 
Python :: python3 add dictionary to dictionary 
Python :: pywhatkit docs 
Python :: random sample with weights python 
Python :: replace value in dataframe 
Python :: correlation python 
Python :: if found then stop the loop python 
Python :: write a list into csv python 
Python :: python print percent sign 
Python :: Import A Model 
Python :: how store list in django session 
Python :: pandas read dictionary 
Python :: get the name of a file using os 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =