How to seperate words from a string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to seperate words from a string

12th Jan 2021, 4:37 PM
Psyco Techie
3 Answers
+ 2
Psyco Techie , may be you mean something like this: - you have an input string like this: "Paris,London,Rome,Berlin" (the separator "," can also a space) - and you want the elements from this string as separate strings or you want to modify them -> you can use something like split(",) for the input string, so they can be put in a list. -> to modify, read, print,... you can use a for loop If this is not what you have expected, please show us your "string" and what you want to do with it. Thanks!
12th Jan 2021, 7:06 PM
Lothar
Lothar - avatar
+ 4
What do you mean "separate words from string"? give an example of input & output to be clear.
12th Jan 2021, 5:15 PM
Ipang
+ 1
Lothar thanks
12th Jan 2021, 7:08 PM
Psyco Techie