filename = 'result'
column = 'Latitude'
os.system("wget http://earthquake.usgs.gov/earthquakes/feed/csv/1.0/hour")
#csv_data = csv.reader(downloaded_data)
file = csv.reader(open('/home/coperthought/Documents/hour' , 'rb'), delimiter='\t')
data = [] # This will contain our data
# Create a csv reader object to iterate through the file
reader = csv.reader( open( '/home/coperthought/Documents/hour' , 'rU'), delimiter=',', dialect='excel')
hrow = reader.next() # Get the top row
idx = hrow.index(column) # Find the column of the data you're looking for
for row in reader: # Iterate the remaining rows
data.append( row[idx] )
os.remove ( '/home/coperthought/Documents/hour')
print data
那么数据就是
['63.190', '63.730', '59.935', '38.805', '61.416', '63.213']
我怎样才能把这个串起来。加入是一个
谢谢
只需使用
'whateveryouwanthere'.join(data)
。 您已经提到了join
方法,如果您不想要一个涉及join
的解决方案,您需要解释这里的问题是什么相关问题 更多 >
编程相关推荐