字符串列表可我有一個像檢查字符串/組字符串(分立|)在Python
Countries = ['United Kingdom', 'United States', 'Luxembourg', 'Canada', 'China', 'Brazil', 'Hong Kong', 'Indonesia', 'Japan', 'India', 'Ireland', 'Germany', 'Australia', 'France', 'Switzerland', 'Malta', 'South Korea', 'Russia', 'Taiwan', 'Bermuda', 'Turkey', 'Mexico', 'Not Applicable', 'Argentina', 'South Africa', 'Malaysia', 'Thailand', 'Singapore', 'Qatar', 'Italy']
str1 = 'United Kingdom'
str2 = 'United States|China|Hong Kong|Italy'
len([col for col in Countries if str1 in col]) > 0
returns TRUE
字符串列表如何檢查在str2中的所有國家無論是在Countries
列表中可用?
TRUE;必須是TRUE;在'python' – languitar