提取字符串中包含两个#字符的词语,谢谢
大家晚上好,我有一个A.txt其内容为(例子):
SAYIJIRAGVLVGSAN#N00S0
SAYIN#DAMJIGVLVGCI
SAYIN#DVR_A
SAYIN#DVR_A-YIN#CERIG
我想提取一行字符串拥有两个#字符的词语,自己尝试if嵌套 没成功,希望您的帮助,谢谢。 >>> str1 = """SAYIJIRAGVLVGSAN#N00S0
SAYIN#DAMJIGVLVGCI
SAYIN#DVR_A
SAYIN#DVR_A-YIN#CERIG"""
>>> for each in str1.split():
if each.count("#") == 2:
print(each) qiuyouzhi 发表于 2021-3-3 20:26
谢谢您的解答,我学到了 {:10_275:}
页:
[1]