Q: Python - How do I write an array to a text file? I have two arrays that are being generated from web scraping every minute. There are two of them below. How do I put them in a text file? I want each array to take up one line and I want them to keep their brackets and commas. I haven't found much help with other topics about this. 
[('76,433', '15.025'), ('99,714', '15.023'), ('44,236', '15.010'), ('718,725', '15.000'), ('30', '15.000'), ('30', '15.000'), ('15', '15.000'), ('15', '15.000'), ('15', '15.000'), ('15', '15.000'), ('60', '15.000'), ('30', '15.000'), ('15', '15.000'), ('30', '15.000'), ('30', '15.000'), ('60', '15.000'), ('30', '15.000'), ('30', '15.000'), ('15', '15.000'), ('30', '15.000')]

[('18,622', '15.027'), ('334', '15.029'), ('3,240', '15.032'), ('11,354', '15.032'), ('13,651', '15.033'), ('96', '15.041'), ('1,997', '15.051'), ('1,760', '15.051'), ('500', '15.052'), ('16,000', '15.053'), ('272', '15.091'), ('3,834', '15.097'), ('8', '15.125'), ('634', '15.141'), ('794', '15.143'), ('528', '15.149'), ('220', '15.150'), ('94', '15.159'), ('91', '15.164')]


A: Considering that you want the file to be used by a Rbx.Lua script, you might be better off using JSON.
repr may produce a single line, but you will need to parse it yourself in Lua. Perhaps not too difficult, but if you ever want to exchange other data types you will need to modify your Lua code. You might also find that repr does not always give you something useful.
Using JSON is easy:
Python:
import json

l = [('76,433', '15.025'), ('99,714', '15.023'), ('44,236', '15.010'), ('718,725', '15.000'), ('30', '15.000'), ('30', '15.000'), ('15', '15.000'), ('15', '15.000'), ('15', '15.000'), ('15', '15.000'), ('60', '15.000'), ('30', '15.000'), ('15', '15.000'), ('30', '15.000'), ('30', '15.000'), ('60', '15.000'), ('30', '15.000'), ('30', '15.000'), ('15', '15.000'), ('30', '15.000')]

with open('l.json', 'w') as outfile:
    json.dump(l, outfile)


$ cat l.json
[["76,433", "15.025"], ["99,714", "15.023"], ["44,236", "15.010"], ["718,725", "15.000"], ["30", "15.000"], ["30", "15.000"], ["15", "15.000"], ["15", "15.000"], ["15", "15.000"], ["15", "15.000"], ["60", "15.000"], ["30", "15.000"], ["15", "15.000"], ["30", "15.000"], ["30", "15.000"], ["60", "15.000"], ["30", "15.000"], ["30", "15.000"], ["15", "15.000"], ["30", "15.000"]]

See http://wiki.roblox.com/index.php?title=JSON for the Rbx.Lua end; you would use DecodeJSON() to convert to a Lua table.

A: Try using the repr function like this, it will keep the array structure intact:
v = [('76,433', '15.025'), ('99,714', '15.023'), ('44,236', '15.010'), ('718,725', '15.000'), ('30', '15.000'), ('30', '15.000'), ('15', '15.000'), ('15', '15.000'), ('15', '15.000'), ('15', '15.000'), ('60', '15.000'), ('30', '15.000'), ('15', '15.000'), ('30', '15.000'), ('30', '15.000'), ('60', '15.000'), ('30', '15.000'), ('30', '15.000'), ('15', '15.000'), ('30', '15.000')]
f.write(repr(v))

Read more about it here.

A: you can convert them to str, then write to file:
    Demo:
f = open('your_file', 'w')
a = ['1', '2', '3']
f.write(str(a)+"\n")

while reading back you can use ast.literal_eval
import ast
f = open("your_file")
for x in f:
    x = ast.literal_eval(x.strip())
    # now do your stuff

