If you just slice based on certain characters, those characters don't appear, but only the words are cut off and stored in the list. For example "Hello, world." If you slice it according to "," ["Hello", "world"] It goes like this ["Hello", ", "World"] I want to make the standard text come out on the list. Is there any way?
python slice string
Please refer to the following
>>> s = "Hello, world"
>>> s.partition(",")
('Hello', ',', ' world')
scala> val s = "Hello, world"
s: String = Hello, world
scala> s.split("(?=,)")
res5: Array[String] = Array(Hello, , world)
© 2024 OneMinuteCode. All rights reserved.