I have a lot of files with string pairs looking like:
first_string~second_string
The first part is what to change and the second, to what change the first part.
These are regular expressions and I run my app with these collections to apply all modifications to dirty tv schedule listings for more than a hundred channels. I did it before with C# but now I am reworking it in Python.
Let's imagine I have a text file with many strings each on its own line that look like find_this~change_to_this. I need to get two lists. First will contain all find strings and the second will contain all change strings.
Let's imagine, I have 120 such pairs. Now I divide these pairs into two lists, each has size of 120 items. One has finds, the other - changes. Now I can get both strings by some index, for example, 57, and it will give me 57th item from both lists, so I get a right change string for any find string. I found some variants, but not sure which one is better.
What is the pythonic to split a collection of strings like this:
first_string~second_string
Using that input to split it into two lists where first list contains items before ~ and the second one - after.
partition?first_string~second_stringexample seems incomplete. Further, you haven't shown the code you're already using. This is justpartitionandsplit. Please include your solution so we can comment on it.