File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1+ # script to generate variable-length random "words" consisting of Unicode codepoints.
2+ #
13from ast import literal_eval
24from datetime import datetime as dt
35import random
46
7+ # TODO: use argparse to pass word number and length via command line
8+
59with open ("ID_Start.txt" ) as start , open ("ID_Continue.txt" ) as cont :
610 starters = [word .strip () for word in start .readlines ()]
711 continuers = [word .strip () for word in cont .readlines ()]
812
913allchars = starters + continuers
10- word_num = 50
14+ word_num = 50 # how many words to write to test file
1115timestamp = dt .now ().strftime ("%Y.%m.%d.%H.%M.%S" )
1216with open ("output." + timestamp + ".py" , "w" ) as output :
1317 for i in range (word_num ):
14- length = random .randint (1 , 10 )
18+ length = random .randint (1 , 10 ) # length of word, between 1 and 10
19+ # make 10 a variable?
1520 word = literal_eval (random .choice (starters ))
1621 for j in range (length ):
1722 if len (word ) == j :
You can’t perform that action at this time.
0 commit comments