如何更改 IF 语句?我只得到无效的语法
predicted_sentiment = [if score < 0 then 'Negative', if score == 0 then 'Neutral' if score > 0 then 'Positive' for score in sentiment_polarity]
你可能想要:
predicted_sentiment = [
('Negative' if score < 0 else 'Neutral' if score == 0 else 'Positive')
for score in sentiment_polarity
]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句