Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.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_String_Python 2.7 - Fatal编程技术网

python字符串基于"\&引用;

python字符串基于"\&引用;,python,string,python-2.7,Python,String,Python 2.7,我必须根据“\”分解以下字符串。问题是,string.split('\')不起作用,re.split(“\/”,text)。 我不知道 字符串很简单 D123D\user.name 第一部分有时较长。您需要在Python字符串文本中转义反斜杠: string.split('\\') 演示: 您需要在Python字符串文本中转义反斜杠: string.split('\\') 演示: 也应该有效 也应该起作用带有尾随奇数反斜杠的原始字符串不起作用。请参见尾随奇数反斜杠的原始字符串不起作用。看

我必须根据
“\”
分解以下字符串。问题是,
string.split('\')
不起作用,
re.split(“\/”,text)
。 我不知道

字符串很简单

D123D\user.name
第一部分有时较长。

您需要在Python字符串文本中转义反斜杠:

string.split('\\')
演示:

您需要在Python字符串文本中转义反斜杠:

string.split('\\')
演示:

也应该有效


也应该起作用

带有尾随奇数反斜杠的原始字符串不起作用。请参见尾随奇数反斜杠的原始字符串不起作用。看
re.split(r"\",text)