For example if I have string "October/November", is there a function that can separate these two words into two strings "October" and "November"?
Asked
Active
Viewed 41 times
-2
-
The answer will depend on the language you want to use so please tag accordingly – Hans Kesting Jan 19 '21 at 06:48
2 Answers
0
Python:
Using f-strings
/ = "" months = f"October{/}November"
print(months)
If you want to make the output show November below October, you can just make / = "\n" or anything else depending on what you want

blankRiot96
- 29
- 5
-
this code does is not valid neither in 2 nor 3 versions of Python. Also, it is not generic as, for instance, does not solve "September/October". Finally, even if it was syntactically correct, it does not seem to yield two strings... – Marcus Vinicius Pompeu Jan 19 '21 at 06:20
0
You may use https://www.w3schools.com/python/ref_string_split.asp:
list_of_strings = "October/November".split("/")

Marcus Vinicius Pompeu
- 1,219
- 1
- 11
- 24