Answers for "python how to parse a string"

2

python parse string

msg = "hi#my#name#is#alon"
msg = msg.split("#")
print(msg)
#output: ["hi", "my", "name", "is", "alon"]
Posted by: Guest on May-09-2020
24

split string python

file='/home/folder/subfolder/my_file.txt'
file_name=file.split('/')[-1].split('.')[0]
Posted by: Guest on April-01-2020

Code answers related to "python how to parse a string"

Python Answers by Framework

Browse Popular Code Answers by Language