【发布时间】:2019-03-31 09:14:45
【问题描述】:
Can someone please tell me what basic thing I am missing here.
Type: <class 'list'>
Value : ['09,10,11,12,13,14,15']
for datapoint in value:
y.append(datetime.fromtimestamp(datapoint).strftime('%I%P').lstrip('0').upper())
I want value of y should be like this-[9PM,10PM,11PM,12PM,1PM,2PM,3PM]
如果我使用上述函数,我不确定为什么它没有转换为我想要的值。有人可以建议我在这里缺少什么以及为什么会出现此错误->“AttributeError:'dict'对象没有属性'append'”
【问题讨论】:
-
y应该是list而不是dict -
@PatrickArtner 我不确定
-
这能回答你的问题吗? 'dict' object has no attribute 'append'
标签: python