current position:Home>python string judgment condition

python string judgment condition

2022-09-09 03:34:12CSDN Q&A

str = a string
a = str.split('\n')
b = 'Mic3'
for x in a:
if b not in x:
a.remove(x)
print(a)
Why does this code print a string without Mic3

copyright notice
author[CSDN Q&A],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/252/202209021224181069.html

Random recommended