Advertisement
askcompu

Untitled

Jul 15th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <Kopachris> so
  2. <Kopachris> answer.split(';') returns a list
  3. <Compu> why would it return a list?
  4. <Compu> why wouldnt it just use a string?
  5. <Kopachris> because it splits the string into a list of substrings delimited by ';'
  6. <-- Onionnion-Work (Ryan@fagh-26-29-37-166.west.biz.rr.com) has left #geek ("Going to school or home")
  7. --> Onionnion-Work (Ryan@fagh-26-29-37-166.west.biz.rr.com) has joined #geek
  8. <Compu> ok
  9. <Kopachris> so we can get just a part of the string
  10. <Compu> i see
  11. <Kopachris> you're trying to access element 1 (the second element) of that list
  12. <Kopachris> and it's telling you that index is out of range, i.e. the list doesn't have that many elements
  13. <Compu> ok that would mean 0 is the first element
  14. <Kopachris> yes
  15. <Compu> so should it be asking for 0?
  16. <Kopachris> no, we still want 1 because it works most of the time
  17. <Compu> so
  18. <-- K|razy1 (Krazy@insert.funny.and.original.vhost.here) has quit (Read error: Connection reset by peer)
  19. <Compu> we should make an exception to try 0 if 1 doesnt work?
  20. <Kopachris> you can try, but I doubt the output will be of any use
  21. <Compu> or if theres only 1 item add another item into 0 and move 0 to 1?
  22. <Kopachris> more likely, if 1 doesn't work, it wasn't able to get a result for the query
  23. <Compu> hmmm
  24. <Compu> how would i find out if thats the case?
  25. <Kopachris> so check the length of the list returned by answer.split()
  26. <Kopachris> and if it's <2, answer = False
  27. <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