<_csv.reader object at 0x104be66d8>
如何在不收到此错误的情况下打印此列表:
text = "I love coding"
secret = "yv5julwo8l7biwuni62r37t823igd87d97u623568yf"
result = `curl -X POST -d '"#{text}"' -H 'Content-Type: application/json' -H 'Authorization: Simple #{secret}' https://api.algorithmia.com/v1/algo/nlp/SentimentAnalysis/0.1.2`
result = JSON.parse(result)
答案 0 :(得分:1)
您可以使用list comprehension
(如果您需要对行执行某些操作)
result = [row for row in csv.reader(...)]
或list()
result = list(csv.reader(...))
-
PS。这给出了列表[ [row1-word1, row1-word2, ...], [row2-word1, ...], ...]