我的功能有问题,并且我一直在标题中粘贴属性错误。
我的代码
std::vector<Shared_ptr<Element>> elementList;
std::shared_ptr<SignalTrack> signalTrack(new SignalTrack(...,...,...));
std::shared_ptr<StraightTrack> straightTrack(new StraightTrack(...));
elementList.push_back(signalTrack);
elementList.psuh_back(sraightTrack);
for (Auto& currentElement : elementList){
doSomething();
}
数据框包含一列,其中Netflix情节的持续时间以字符串形式编写。在此列中,以“ 1 Season”和“ 94 mins”两个结构为例,混合了各种值。
我的函数应该读入值以检查字符串结构并仅返回数字。谢谢。
答案 0 :(得分:2)
使用in
operator检查Wheter字符串是否包含子字符串([substring] in [string]
)
>>> "a" in "abc"
True
>>> "ab" in "abc"
True
>>> "d" in "abc"
False
>>> x = "abc"
>>> y = "a"
>>> y in x
True