1d = {}
2with open("file.txt") as f:
3 for line in f:
4 (key, val) = line.split()
5 d[int(key)] = val
1price = 33.3
2with open("Output.txt", "w") as text_file:
3 text_file.write("Purchase Amount: %s price %f" % (TotalAmount, price))
1$.get('txt/messages.txt', function(txt) {
2var lines = txt.responseText.split("\n");
3var randLineNum = Math.floor(Math.random() * lines.length);
4return lines[randLineNum]; // random line from the text file
5});