このapiはPythonで動作していて、.csvファイルを更新することができますが、印刷物を印刷するだけでどこにこのデータが出力されているのかわかりません。私のコードは以下の通りです。端末で実行しているときにpython printlnが実行されます
import urllib
import os
import time
# loop that checks stock prices every 20 seconds and adds them to the file
while 1:
# sometimes this program gives me socket errors so if it does skip this itteration of the loop
try:
stocks = urllib.urlopen('http://finance.yahoo.com/d/quotes.csv?s=JPM+C&f=snl1c6').read()
except IOError:
print ("error reading the socket")
time.sleep(120) #if we don't sleep here loop constently retrys with no delay
continue
print stocks
コードとして書式を設定するには、各行の前に4スペースを追加します(投稿の編集を押して、どのように表示されたかを確認してください)。 –