阅读背景:

Python列表推导:将数组中的所有元素设置为0或1

来源:互联网 

I've been trying to come up with a one line list comprehension to do the following: Given an array of integers and a single integer, call it int1, I want to create a new array of only 0's and 1's such that the new array has a 1 if there was an int1 at that position in the original array else 0.I've been trying to come up with a one line lis




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: