Hadis
0
Q:

python parse string

# Default splits at whitespace
txt = "Welcome to the jungle, baby!"
txt.split()
# Output:
# ["Welcome", "to", "the", "jungle," "baby!"]

# You can specify where to split
txt = "Welcome to the jungle, baby!"
txt.split(", ")
# Output:
# ["Welcome to the jungle", "baby!"]
72
msg = "hi#my#name#is#alon"
msg = msg.split("#")
print(msg)
#output: ["hi", "my", "name", "is", "alon"]
1
str.split(separator, maxsplit)
-2

New to Communities?

Join the community