我在我的Openshift托管的Python/Flask应用程序上添加了一个PostgreSQL 9.2数据库,但现在我认为不需要它.是否有一种简单的方法可以从应用程序中删除此墨盒?
我试图以.csv的形式从雅虎财经中提取数据,然后将第1列和第5列转换为Python中的列表.如果先前已经下载了.csv,那么将列转换为列表的代码部分是有用的,但我正在尝试做的是直接将数据从url获取到Python中.
我得到的错误是"属性错误:'模块'对象没有属性'请求'." 这是代码:
import urllib
def data_pull():
#gets data out of a .csv file from yahoo finance, separates specific columns into lists
datafile = urllib.request.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=xom&a=00&b=2&c=1999&d=01&e=12&f=2014&g=m&ignore=.csv')
datafile = open(datafile)
datelist = [] #blank list for dates
pricelist = [] #blank list for prices
for row in datafile:
datelist.append(row.strip().split(","))
pricelist.append(row.strip().split(","))
datelist = zip(*datelist) #rows into columns
datelist = datelist[0] #turns the list into data from the first column
pricelist = zip(*pricelist)
pricelist = pricelist[4] #list gets data from the fifth column
print …Run Code Online (Sandbox Code Playgroud)