"Any" means "at least one". Use this tag for questions that deal with testing elements in a collection to see if at least one of them passes a condition.
Questions tagged [any]
682 questions
-1
votes
6 answers
How to grep the number in text file?
i want to ask a question about 'awk' , example:
awk '{print $8}' tes.txt
output : size=21341,
but i only want to grep number "21341", can you give me solution about how to grep the number?

Aris Pratama
- 3
- 1
- 3
-1
votes
1 answer
Angular2 service subscription: Parameter implicitly has an any type
Can anyone help me out. The error is Parameter 'item' implicitly has an any type... Please click on the link below to see the image.
Click to view the image

Dhanush
- 29
- 3
-1
votes
3 answers
Combining ifelse and any to create new column - R 3.3.2 Windows 7
I have a data.table and I'm trying to create a new column by checking to see if a row has particular values in any of a given set of columns.
head(d1)
MEDREC_KEY pat_key drug1 drug2 drug3 drug4 drug5 …

ericotta
- 67
- 7
-1
votes
1 answer
C# penultimate of a number
So my question is how can I retrieve the penultimate digit of the number that the user wrote down? Below is my code so far:
Console.Write("Write a numeral: ");
string s = Console.ReadLine();
int a = int.Parse(s);
user7490434
-1
votes
3 answers
What does the builtin function any() do?
I did some google searching on how to check if a string has any elements of a list in it and I found this bit of code that works:
if any(i in string for i in list):
I know this works, but I don't really know why. Could you share some insight?

Conyare
- 105
- 10
-1
votes
1 answer
SyntaxError in any() test
I am pretty new to python syntax ... how do I use the or operator in this scenario?
To check if files end with either '.txt' or '.sm3dump', I tried to use any(), but I got a SyntaxError:
if any(filename.endswith('.txt'),…

Eric T
- 1,026
- 3
- 20
- 42
-1
votes
1 answer
Swift conversion from any to arrays, or dictionaries
Simple example that I don't understand why is not working:
let f: Any = ["": 1]
if let f = f as? [String: Any] {
"" // never enters
}
I'm trying to get this around my head, but don't understand why does this not work. I'm trying to work with…

Jake Ortiz
- 503
- 9
- 20
-1
votes
1 answer
Convert image on url to a file without saving?
I have about 300 people wanting to view loads of images at a time but its not possible to download all the images to file. So i need a way where you can use a web url ("http://capes.reflexpro.co.uk/?user=" + p_177166_1_.getName()) to get the image…

BiLLYBOB
- 3
- 1
-1
votes
1 answer
PythonXY, spyder and python any() function
I'm trying to search words in a text with the function any() of python, I was expecting the same behaviour for the two following, but it's not:
keyword_list=['WASHER', 'SCREW']
all_text = "test_string"
if any(word in all_text for word in…

tinix84
- 57
- 5
-1
votes
1 answer
PHP regular expression - how to search for anything
i.e. i have a string, which contains ANY,ANY kind of symbols,words, sentences:
%6tge9ruj+_]`\Qe,3[][}~[wq]we-Oke|\;'"_p}|P{dl3=+fmwfoe-f
how to:
1) get everything between and
2) replace everything and…

T.Todua
- 53,146
- 19
- 236
- 237
-2
votes
1 answer
Does Python 'any' function requires evaluating all boolean values?
Consider the following python instruction
any([condition(element) for element in some_list])
Is it optimised to stop once condition(element) is True, or any is applied after the whole list of boolean values is built?
If case the the whole list is…

cyanide
- 3,885
- 3
- 25
- 33
-2
votes
1 answer
difference array.any() vs. np.any(array())
Simple question, confusing output:
np.array([-1, 0, 1]).any() < 0
out: False (why??)
but:
np.any(np.array([-1, 0, 1]))
out: True (as expected)
Acoording to documentation both commands should be equivalent, but they aren't.

faustus
- 1
-2
votes
1 answer
How do I use .any() to print the value I am looking for?
If I have the following code
if "ERB-776-RAD" in my_data.any():
print("I found it!")
Where the my_data is something as follows:
my_data = ['ERA-776-TRF','FDS-342-FHS','EBR-776-RAD'...]
How would I print the actual value I am looking for…

AScientist9797
- 21
- 3
-2
votes
2 answers
Why is Python any( pred for _ in _ ) much faster than for loop
This question is very similar to: this post, but I couldn't find the answer there.
# 0m2.676s
#
# note that it should be == instead of in
# but as far as timing goes, it would be even faster
# (thanks to @Booboo for pointing this)
#
# here:…

OrenIshShalom
- 5,974
- 9
- 37
- 87
-2
votes
1 answer
Swift: Comparing Equatable Class object I get error Binary operator '==' cannot be applied to two 'Any' operands
I have the following class:
import UIKit
class SomeClass: Equatable {
var Obj: Any
init(Obj:Any) {
self.Obj = Obj
}
static func == (lhs: SomeClass, rhs: SomeClass) -> Bool {
return lhs.Obj == rhs.Obj
…

user2924482
- 8,380
- 23
- 89
- 173