There is in Python option to declare array like this?
arr = [x for x in vec where x < 2]
- (Edit: sorry for the 'from'. my common mistake (the eclipse always repair me))
(or another statement without real loop)
There is in Python option to declare array like this?
arr = [x for x in vec where x < 2]
- (Edit: sorry for the 'from'. my common mistake (the eclipse always repair me))
(or another statement without real loop)
Use if
instead:
arr = [x for x in vec if x < 2]
And note that it is a for
loop, the from
keyword does not exist.