我搜索并回答,但找不到答案。
我无法将该str列出 如何将其打印为列表?
请咨询。
punctuation = ['.','(',')','?',':',':',',','.','!','/','"',"'",'@','#','$','%','^','&','*']
tokenize = str(input("Please enter a sentence " ))
tokenize = "".join(char for char in tokenize if char not in punctuation)
print ("Tokenized:",tokenize.lower())
答案 0 :(得分:0)
您可以将[FindsBy(How = How.Id, Using = "userNameInput")]
private IWebElement loginUsername;
public void UserName()
{
WebDriverWait wait = new WebDriverWait(Browser.Driver, new TimeSpan(0, 0, 5));
wait.Until(ExpectedConditions.ElementIsVisible(By.Id("userNameInput")));
loginUsername.Click();
loginUsername.SendKeys("admin");
}
[FindsBy(How = How.Id, Using = "passwordInput")]
private IWebElement loginPassword;
public void Password()
{
WebDriverWait wait = new WebDriverWait(Browser.Driver, new TimeSpan(0, 0, 5));
wait.Until(ExpectedConditions.ElementIsVisible(By.Id("passwordInput")));
loginPassword.Click();
loginPassword.SendKeys("SAd@12340");
}
与交替模式一起使用:
re.split
样本输入和输出:
import re
punctuation = ['.','(',')','?',':',':',',','.','!','/','"',"'",'@','#','$','%','^','&','*']
tokenize = str(input("Please enter a sentence: " ))
print(re.split('|'.join(map(re.escape, punctuation)), tokenize))