-2

For example if I have string "October/November", is there a function that can separate these two words into two strings "October" and "November"?

2 Answers2

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

  • 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