Hi, i have the following python script that reads json data from a website and writes it in a csv file that i will then import to excel. (i have just started since a week with py so i'm a noob!) : -------------------------------------------------------
import json import urllib import csv url = "http://bitcoincharts.com/t/markets.json" response = urllib.urlopen(url); data = json.loads(response.read()) f = open("/home/io/markets.csv","wb") c = csv.writer(f) # write headers c.writerow(["Currency","Symbol","Bid", "Ask", "Volume"]) for d in data : if d["currency"] <> "SLL": #esclude la valuta di secondlife SLL if d["bid"] is not None and d["ask"] is not None: c.writerow([str(d["currency"]),str(d["symbol"]),str(d ["bid"]),str(d["ask"]),str(d["currency_volume"])]) ------------------------------------------------------ I have an .ods file (libre calc - i'm on linux) where i have in a sheet called "exclusions" a list of names (symbol) the i want to exclude during the import from web. I would like to modify my script so that it can parse each row in the "exclusion" sheet and if "symbol" = "parsed row value" then don't write it to the csv file ... to loop on all values in the "exclusion" sheet. I know it's certainly possible but i don't know how to do that. (if it results easier having the exclusion list in a text file it's not a problem, i'm not really stuck with librecalc!) Thanks in advance to any helpful soul! :-) -- http://mail.python.org/mailman/listinfo/python-list