I have a string like this search = 'hello' and I need check all array to see if any contains hello.
For example:
"hello" == "123hello123" | true
"hello" == "aasdasdasd123hello123" | true
"hello" == "123123hello" | true
I need something like search for my code
list_all_files_in_google_drive - it my all file name array
filename - name file, which need to check if exist in google drive or not
if not any(file['title'] == filename for file in list_all_files_in_google_drive):
print('file not exist')
my code doesn't work because it works like this:
"hello" == "123hello123" | false
"hello" == "aasdasdasd123hello123" | false
"hello" == "123123hello" | false
"hello" == "hello" | true
and I need it to work like this:
"hello" == "123hello123" | true
"hello" == "aasdasdasd123hello123" | true
"hello" == "123123hello" | true
"hello" == "hello" | true
UPD:
I checked operator in and it does not output true
filename = 'hello'
list = ['123hello123', 'aasdasdasd123hello123', '123123hello']
if filename in list:
print('true')
in. That's not what Rakesh told you to do.