import datetime
a = '20180204'
a_time = datetime.datetime.strptime(a,'%Y%m%d')
结果是
datetime.datetime(2018, 2, 4, 0, 0)
和print(a_time)
2018-02-04 00:00:00
我希望它只是像'208-02-04'那样显示出来。我可以使用哪个命令?
我用matplotlib显示它
x_list = list()
y_list = list()
for i in range(0,len(stock_order)): # stock_order is a list of tuple
x = stock_order[i][0]
xt = datetime.datetime.strptime(x,'%Y%m%d')
x_list.append(x)
y = stock_order[i][1]
y_list.append(y)
plt.plot(x_list,y_list)
plt.show()
如何让X轴显示清晰美观?