如何跳过for循环中的下一个迭代,python?

时间:2018-02-07 15:45:45

标签: python loops next skip

co1=["CM","CD","XC","XL","IX","IV"]
s='AAMCML'

for i,j in enumerate(s):
    if i<len(s)-1 and ((j+s[i+1]) in co1):
        print(j+s[i+1])
        **SKIP NEXT LOOP VALUE (I don't need the next value in loop to be printed. 
                                                               Here it would be M)**
    print(j)

我希望打印结果像[A A M CM L](它不一定是列表,只需打印)。在这种情况下,不应在输出中打印C后的M。任何建议都会有所帮助!

0 个答案:

没有答案