[英]Python Regex - Get Substring Starting with part of word and ending with certain character
I've searched the forum high and low and just can't seem to piece together the knowledge to build a python regex for this.我搜索了论坛的高低,似乎无法拼凑知识来为此构建 python 正则表达式。 I need to get the date (Tuesday, May 12) out of this string.
我需要从这个字符串中获取日期(5 月 12 日,星期二)。 The actual date will vary, but will always include a day of the week (ex: Tuesday).
实际日期会有所不同,但始终包括一周中的某一天(例如:星期二)。
["Text content goes here,","week","Yes","Tuesday, May 12",2,"110519",2]
a = ["Text content goes here,","week","Yes","Tuesday, May 12",2,"110519",2] b = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday": "Sunday"] for text in a: for day in b: if type(day) == type(text): if day in text: print(text) a = ["文本内容放在这里,","week","Yes","Tuesday, May 12",2,"110519",2] b = ["Monday", "Tuesday", "Wednesday", " Thursday", "Friday", "Saturday": "Sunday"] 对于 a 中的文本:对于 b 中的天:如果 type(day) == type(text): if day in text: print(text)
Try this.尝试这个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.