简体   繁体   中英

Python list.index behaviour on OSX?

I am studying someone else's code that was written in Python on a Mac. I am using a PC. They use list.index in cases where exceptions will be generated (ie: the items are missing), but they don't have exception handling. Therefore, I am trying to work out why their code ran successfully.

Does list.index generate exceptions on a Mac when items are missing, or is its behaviour different? Thanks.

I had errors upstream, my fault! Thanks guys.

Could you provide an example of the code that ran successfully on their machine, but not yours? The behavior of list.index shouldn't be os dependent. It should throw a ValueError if the item is not in the list (at least in Python 3.4).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM