Re: Import Json web data source to xls or csv

2013-02-21 Thread Peter Otten
rusi wrote: > On Feb 20, 6:54 am, Michael Herman wrote: >> c = csv.writer(f) >> c.writerow([str(d["currency"]),str(d["symbol"]),str(d["bid"]), >> str(d["ask"]),str(d["currency_volume"])]) > Tried it with and without the str and there are small differences. The actual differences: float values a

Re: Import Json web data source to xls or csv

2013-02-20 Thread rusi
On Feb 20, 6:54 am, Michael Herman wrote: > First - you can use Python in > Excel.http://www.python-excel.org/orhttps://www.datanitro.com/ > > Updated code: > > import json > import urllib > import csv > > url = "http://bitcoincharts.com/t/markets.json"; > response = urllib.urlopen(url); > data =

Re: Import Json web data source to xls or csv

2013-02-20 Thread io
That worked perfectley! Thanks alot. -- http://mail.python.org/mailman/listinfo/python-list

Re: Import Json web data source to xls or csv

2013-02-20 Thread Michael Herman
Looks like you got it figured out. The indentation error probably occurred from the copy and paste job into the email. If you're interested in getting up to speed quickly on Python and Python Web Development, I have a kickstarter going - http://kck.st/VQj8hq The $25 pledge will give you access to

Re: Import Json web data source to xls or csv

2013-02-20 Thread pyplexed
Try something like: for d in data: 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've used 'is not None' in case 0 or 0.0 are acceptable bid or offer values. If you want to ex

Re: Import Json web data source to xls or csv

2013-02-20 Thread io
Il Wed, 20 Feb 2013 06:59:46 +, Cousin Stanley ha scritto: > io wrote: > >> >> How do i manage to read the data source from >> http://bitcoincharts.com/t/markets.json >> I just need currency, symbol, bid, ask, volume > > Following is a simple way load the json data and write

Re: Import Json web data source to xls or csv

2013-02-19 Thread io
Hi Michael (name of my son) and thanks for the big help. I'm starting to love python sintax (did they call it python for the slim it is compared to other languages?) Your code didn't work immediatley as it was givin an indentation error that i sorted out quickly fixing the last two lines. It w

Re: Import Json web data source to xls or csv

2013-02-19 Thread Cousin Stanley
io wrote: > > How do i manage to read the data source > from http://bitcoincharts.com/t/markets.json > > I just need currency, symbol, bid, ask, volume > Following is a simple way load the json data and write the desired fields to a .csv file import json import urllib url

Re: Import Json web data source to xls or csv

2013-02-19 Thread Michael Herman
First - you can use Python in Excel. http://www.python-excel.org/ or https://www.datanitro.com/ Updated code: import json import urllib import csv url = "http://bitcoincharts.com/t/markets.json"; response = urllib.urlopen(url); data = json.loads(response.read()) f = open("bitcoin.csv","wb") c =

Import Json web data source to xls or csv

2013-02-19 Thread io
Hi, i'm new to python and programming with it and so for json format. I have my excel 2010 program with vba that does the following : - read the data flow from http://bitcoincharts.com/t/markets.json - elaborate it and puts it in excel 2010 for further calculations What i'm willing to do is the