lists = ['ttxx', 'ttss', 'txx', 'tss', 'config', 'gzip'] for i in lists: if i.endswith('xx'): # 以什么结尾 print(i) for s in lists: if s.startswith('t'): # 以什么开头 print(s)
lists = ['ttxx', 'ttss', 'txx', 'tss', 'config', 'gzip'] for i in lists: if i.endswith('xx'): # 以什么结尾 print(i) for s in lists: if s.startswith('t'): # 以什么开头 print(s)