My objective is to search a small csv file (one column, a few hundred rows) for a value.  The rows in the csv are all numbers.  Here is my attempt:

import csv

#read csv file
csv_reader = csv.reader(open('test.csv', 'rU'))

length_list = len(list(csv_reader))
value = []

for line in csv_reader:
    value.append(line) #transfer contents of csv to list

def find_voucher(input_voucher, counter):
    while counter &lt; length_list:
        check_voucher = input_voucher in value[counter]
        if check_voucher == True:
            print "TRUE"
        else:
            print "FALSE"
    counter = counter + 1
find_voucher(1000,1)


When I run the script I get this error:

check_voucher = input_voucher in value[counter]
IndexError: list index out of range



Question: Rice gets burnt and watery
Answer: Assuming plain (American) white rice on a stovetop:

(Generally, American rice does not need rinsing for these applications)

From your description, it sounds like you are going for Steamed Rice; for that, here's what you want to do:

Bring your water, salt and butter to a boil, then add your rice. Stir it until it comes back to a boil. As soon as it boils again, turn your heat way down. Keep stirring until the heat is low enough that you feel safe that you can cover the pot without it hard boiling again. Cover and keep on low to medium-low heat or a moderate simmer (preferably without peeking) for 20 minutes (15 minimum). It is the steam that plumps the rice, so don't lift the lid! It may take some tweaking depending upon your specific equipment, but try to be patient. You may find that you like a little less water and a bit more time. When you do peek (hopefully after at least 15-20 minutes have passed) look for the water to be gone and for little holes or "divots" to be formed on the surface of the rice. If you still have water, cover again and keep cooking without lifting the lid for at least 5 more minutes. When it looks done, turn off the heat but still don't stir, you're better off just letting it sit for another 5 minutes - re-covered and with the heat turned off, then stir/fluff it.

If you find that your rice isn't done after 20-25 minutes with the lid on, bring up the heat a bit, but be careful. If your heat is too high, your rice can burn on the bottom. Within reason, if it's just a bit too low, it'll just take longer.

The lid is really key here. Do you have a tight lid for the pan that you are using? If not, we can help you improvise.

A slightly different method using the same ingredients is the Pilaf Method shown here in a great video from the love of my life, Alton Brown. 20 Minute Pilaf See the rice just before he fluffs it with chopsticks? Those are the holes/divots I referred to above in the explanation of the steaming method. In case the link goes bad, here's a description of the video: Bring 3 cups of water to a rolling boil. Meanwhile, in a saucepan with a tight lid, melt and lightly brown 2 Tbs of butter over high heat. Add 2 cups of rice (regular long grain, basmati or jasmine recommended) and saute for a couple of minutes, add 1 tsp salt (Alton uses kosher). When the rice smells "nutty" add the boiling water all at once (careful, it will boil rather violently). Cover and turn heat to low. No peeking, cook on low for 15 minutes. Fluff with chopsticks or a fork. Cover again for 5 minutes, no heat.

Note that Alton's pilaf also requires a tight fitting lid. If your lid isn't tight, try using aluminum foil to get a tighter seal.

Finally: With very small variations, these two methods of cooking rice will work fine for just about any type of rice. Some rice, particularly some rice harvested outside of the US should be thoroughly rinsed first. Check your label if you can or revisit this question if you're not sure if your rice should be rinsed. If you use rinsed rice you may find that you want to use slightly less water for cooking than instructed here.

You're using a 2 to 1 ratio for steaming rice, that's fairly typical but you might like a bit less water, just don't go lower than 1.5 to 1. 

Brown rice works fine for these methods too but will take longer and require slightly more water.

The steaming method, particularly if you wait to "fluff" will produce a stickier rice, better for chopsticks :) and better to accompany food that has a sauce you want the rice to soak up. I prefer steamed rice to go with stir-fries, for example.

The pilaf method, particularly with medium to long grained rice will produce more individual grains. Nice with steak or baked chicken, something that isn't sauced.