python - Copy text from website to text/excel file -


i'm trying create simple (hopefully) python script copies text address:

http://api.bitcoincharts.com/v1/trades.csv?symbol=mtgoxusd

to either simple text file or excel spreadsheet.

i've tried utilising urllib , resquests libraries, every time try , run basic script, shell wouldn't display anything.

for example,

import requests data = requests.get('http://api.bitcoincharts.com/v1/trades.csv?symbol=mtgoxusd') data.text 

any appreciated. thank you.

you're done;

import requests symbol = "mtgoxusd" url = 'http://api.bitcoincharts.com/v1/trades.csv?symbol={}'.format(symbol) data = requests.get(url)  # dump resulting text file open("trades_{}.csv".format(symbol), "w") out_f:     out_f.write(data.text) 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -