Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Kopachris> so
- <Kopachris> answer.split(';') returns a list
- <Compu> why would it return a list?
- <Compu> why wouldnt it just use a string?
- <Kopachris> because it splits the string into a list of substrings delimited by ';'
- <-- Onionnion-Work (Ryan@fagh-26-29-37-166.west.biz.rr.com) has left #geek ("Going to school or home")
- --> Onionnion-Work (Ryan@fagh-26-29-37-166.west.biz.rr.com) has joined #geek
- <Compu> ok
- <Kopachris> so we can get just a part of the string
- <Compu> i see
- <Kopachris> you're trying to access element 1 (the second element) of that list
- <Kopachris> and it's telling you that index is out of range, i.e. the list doesn't have that many elements
- <Compu> ok that would mean 0 is the first element
- <Kopachris> yes
- <Compu> so should it be asking for 0?
- <Kopachris> no, we still want 1 because it works most of the time
- <Compu> so
- <-- K|razy1 (Krazy@insert.funny.and.original.vhost.here) has quit (Read error: Connection reset by peer)
- <Compu> we should make an exception to try 0 if 1 doesnt work?
- <Kopachris> you can try, but I doubt the output will be of any use
- <Compu> or if theres only 1 item add another item into 0 and move 0 to 1?
- <Kopachris> more likely, if 1 doesn't work, it wasn't able to get a result for the query
- <Compu> hmmm
- <Compu> how would i find out if thats the case?
- <Kopachris> so check the length of the list returned by answer.split()
- <Kopachris> and if it's <2, answer = False
- <Kopachris> and the next bit (if answer: ... else: phenny.reply('Sorry, no result') ) will take
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement