So basically I have this code:
try:
fhanddate = open('AAPLprice.txt')
except:
print 'Could not open file - closing application'
exit()
stock_date = []
for line in fhanddate:
p = line.strip()
q = p.split(',')
r = q[0:]
stock_date.append(r)
for line in stock_date:
pass
last = line
print last[0]
try:
fhanda = open('AAPLprice.txt')
except:
print 'Could not open file - closing application'
exit()
stock_priceA = []
for line in fhanda:
p = line.strip()
q = p.split(',')
r = q[-1:]
stock_priceA.append(r)
print max(stock_priceA)
My output as a result is :
2015-07-21
['129.606052']
So I want to know how I can combine both of these outputs so I get : 2015-07-21 129.606052 , as a result
When I try to just combine them I get the "TypeError: cannot concatenate 'str' and 'list' objects" error