I have, e.g., the following lines in the middle of a larger text
Beijing
Berlin
London
Moscow
New York
Paris
How do I shuffle that list (and not the rest of the text) ?
Thanks in advance
I have, e.g., the following lines in the middle of a larger text
Beijing
Berlin
London
Moscow
New York
Paris
How do I shuffle that list (and not the rest of the text) ?
Thanks in advance
First, you need to know how to find where the list starts and ends. Methods:
Second, you have a Python action that does something like:
import random
my_list = my_text.split('\n')
random.shuffle(my_list)
my_text = '\n'.join(my_list)
Here's a very simple workflow that shuffles the selected lines:
http://www.editorial-workflows.com/workflow/5835284772028416/4_zBQGBrkcA
The Python code is obviously very similar to @ccc's.
@ccc
First of all, thank you
But, second, I get an error, which most certainly originates in the fact that I am an ignoramus in Python, and do not know how to adapt your answer to my needs.
Thank you again nevertheless
@omz
Thank you very much for youe answer, which works perfectly.
And thank you too for Editorial, which is a truly beautiful app (NB: on Mac OSX, my editor of choice is Vim, not for programming, but for writing)
Side question (only answer if you have got time) : how to sort that same list on the n-th column ?
And of course, best wishes for 2017