字符串'AABCDEFGHHIJ'中如果我要取得ACGJ,并在一行内显示,要怎么切片,怎么print结果
以下是我的代码:
s='AABCDEFGHHIJ'
a=s[1:5:2]
b=s[7:12:4]
template='a{}'
result=template.format(b)
print(result)
上面是我的代码不知道哪里出错
字符串'AABCDEFGHHIJ'中如果我要取得ACGJ,并在一行内显示,要怎么切片,怎么print结果
以下是我的代码:
s='AABCDEFGHHIJ'
a=s[1:5:2]
b=s[7:12:4]
template='a{}'
result=template.format(b)
print(result)
上面是我的代码不知道哪里出错