Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

shuffle text lines python

import random
with open('the_file','r') as source:
    data = [ (random.random(), line) for line in source ]
data.sort()
with open('another_file','w') as target:
    for _, line in data:
        target.write( line )
 
PREVIOUS NEXT
Tagged: #shuffle #text #lines #python
ADD COMMENT
Topic
Name
6+2 =