Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 从反斜杠拆分字符串_Python_Python 3.x_Selenium - Fatal编程技术网

Python 从反斜杠拆分字符串

Python 从反斜杠拆分字符串,python,python-3.x,selenium,Python,Python 3.x,Selenium,我想从反斜杠上划出一条线 a = 'anido_\na.\nSearch' 我试图从字符串中刮取anido,但没有使用 a.split(“\\”),a.partition(“\\”) 字符串来自Selenium的 驱动程序。通过xpath(elem)查找元素。text 因此,我不认为有任何其他方式可以刮除字符串。尝试将其拆分为 a = 'anido_\na.\nSearch'.split('\n')[0] 要获取作为输出的“anido”,请共享同一链接的HTML代码示例

我想从反斜杠上划出一条线

a = 'anido_\na.\nSearch'
我试图从字符串中刮取anido,但没有使用

a.split(“\\”)
a.partition(“\\”)

字符串来自Selenium的

驱动程序。通过xpath(elem)查找元素。text

因此,我不认为有任何其他方式可以刮除字符串。

尝试将其拆分为

a = 'anido_\na.\nSearch'.split('\n')[0]

要获取作为输出的
“anido”

请共享同一链接的HTML代码示例