我有一个文件,内容如下:
hello//hello1
this is a file
good-morning我想检查以双引号开头和结尾,并在引号之间有//字符的模式,如上面的字符串所示。输出应为:
hello//hello1发布于 2015-04-03 20:46:34
试着这样做:
>>> my_string
'"hello//hello1" this is a file "good-morning"'
>>> re.findall('"\w+//\w+"', my_string)
['"hello//hello1"']发布于 2015-04-03 20:51:00
使用findall尝试一下
>>>re.findall('"\w+//\w+"','mystring "hello//hello1" sample')
['"hello//hello1"']https://stackoverflow.com/questions/29432389
复制相似问题