You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
514 B
Python
25 lines
514 B
Python
|
|
# This script convert a txt file into a js containing an array with each line of the txt
|
|
|
|
# I would like make a command from this, like > arraygen [name var] [input file] [outputfile]
|
|
|
|
fl = open("filoXX_nF.txt", "rt")
|
|
|
|
rd = fl.read()
|
|
|
|
lst = rd.splitlines()
|
|
|
|
with open("filoXX.js", "w") as output:
|
|
output.write(str(lst))
|
|
|
|
fl.close()
|
|
|
|
with open('filoXX.js', 'r') as original:
|
|
data = original.read()
|
|
|
|
with open('filoXX.js', 'w') as modified:
|
|
modified.write("var x = " + data + ";")
|
|
|
|
|
|
|