I have two lists like:
- "mexc_names"
mexc_names =['ogn_usdt','qnt_usdt',btc_tryb', sbr_usdt',kton_eth,'kton_eth','kton_eth'] - "kraken_names"
kraken_names = ['ognusd','qnteur', aaveeth, 'sbrusd', 'aaveeth', 'adaeth',' algoeth']
I'm able to return both names in each list if the first half of a string in mexc_names (before the "_") is contained in any string in kraken_names. Done by doing this:
for y in kraken_names:
if x.partition("_")[0] in y:
print(x,y)
Where I get something like:
ogn_usdt ognusd
qnt_usdt qnteur
sbr_usdt sbrusd
However, I want to return matching strings if the first half of a string in mexc_names (before the "_") is in a string in kraken_names AND if the second half of the string in mexc_names is in a string in kraken names.
So I do this:
for y in kraken_names:
if (x.partition("_")[0] and x.partition("_")[2]) in y:
print(x,y)
And get the result:
kton_eth adaeth
kton_eth algoeth
kton_eth anteth
kton_eth atometh
kton_eth baleth
kton_eth bateth
kton_eth bcheth
Sadly, this seems just to get strings that contain the second half of the string in mexc_names but not the first.
I'm looking to get something like:
ogn_usd ognusd
qnt_usdt qntusd
sbr_usd sbrusd