多次使用split函数和tweepy导致IndexError:列表索引超出范围

时间:2016-03-08 04:30:34

标签: python twitter tweepy

我正在使用:inoremap <C-s> <Esc>:w<CR>功能,它在split上失败并给我错误:

data

数据等于:

 IndexError: list index out of range

代码:

1457410676.51::RT @robbwolf: Earthquake in Reno! Wacky. 1457410777.98::13:19 #\u5730\u9707 #earthquake https:\/\/t.co\/2X8FaipZsW 1457410814.04::1.7 magnitude #earthquake. 12 mi from Anza, #CA, United States https:\/\/t.co\/1GWexXmLom 1457410819.04::1.7 magnitude #earthquake. 12 mi from #Anza, CA, United States https:\/\/t.co\/fL5MDx7bhS

1 个答案:

答案 0 :(得分:0)

,"text":"的值不包含令牌split,因此IndexError的结果是一个项目列表 - 其中包含整个文本。

为避免,"text":"中出现data验证token = ',"text":"' if token in data: text = data.split(token)[1]

@font-face {
 font-family: 'Glyphicons Halflings';
 src: url('/assets/glyphicons-halflings-regular.eot');
 src: url('/assets/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('/assets/glyphicons-halflings-regular.woff') format('woff'), url('/assets/glyphicons-halflings-regular.ttf') format('truetype'), url('/assets/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');
}