M
M
mandico212021-07-24 05:53:45
Python
mandico21, 2021-07-24 05:53:45

How to properly compare lists in Python?

60fb80ad36b68408969232.jpeg
Guys, how to compare words in Python?
If I compare A1 == C1, it will be False. But in fact they seem to be, it’s just that the region is also registered in A1.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alan Gibizov, 2021-07-24
@phaggi

So compare lists, strings or words?
If you look at a specific screenshot, I see two lines. The string in column C is contained in the string in column A.
Just such an occurrence is easily found by this construction:

string_a = 'Санкт-Петербург, Ленинградская область'
string_b = 'Санкт-Петербург'
print(string_b in string_a)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question