我想要的东西不是字符串。我看过this并指出:
这适用于点赞:
library(datasets)
library(dplyr)
msleep %>%
select(name, sleep_total) %>%
filter(str_detect(tolower(name), pattern = "mouse"))
但这不适用于以下情况:
msleep %>%
select(name, sleep_total) %>%
filter(str_detect(tolower(name), pattern != "mouse"))
我明白了:
Error in filter_impl(.data, quo) :
Evaluation error: object 'pattern' not found.
有没有办法做到这一点?
答案 0 :(得分:4)
如评论中所述,我得出了一个答案:
msleep %>%
select(name, sleep_total) %>%
filter(!str_detect(tolower(name), pattern = "mouse"))
!str_detect
是做到这一点的方法。
答案 1 :(得分:1)
您可以使用否定前瞻:
from requests.auth import HTTPBasicAuth
r = requests.get('https://api.outbrain.com/amplify/v0.1/login', auth=HTTPBasicAuth('user', 'pass'))