- 帖子
- 7
- 精华
- 0
- 积分
- 35
- 阅读权限
- 10
- 注册时间
- 2017-9-4
- 最后登录
- 2018-1-22
|
这是错误报告, 我认真看了, 完全看不懂... \d{2}表示2个数字, \/我想表示"/"这个符号. 请问是错在哪里呢? 谢谢大家!
---------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-19-16b473c8f9ae> in <module>()
13
14
---> 15 LifeClock()
<ipython-input-19-16b473c8f9ae> in LifeClock()
4 def LifeClock():
5 bday = input("Please enter your date of birth(mm/dd/yyyy): ")
----> 6 m = re.findall("^\d{2}+\/+\d{2}+\/+\d{4}$", bday)
7 if m:
8 print (m)
/mnt/lovelace/software/anaconda/envs/py35/lib/python3.5/re.py in findall(pattern, string, flags)
211
212 Empty matches are included in the result."""
--> 213 return _compile(pattern, flags).findall(string)
214
215 def finditer(pattern, string, flags=0):
/mnt/lovelace/software/anaconda/envs/py35/lib/python3.5/re.py in _compile(pattern, flags)
291 if not sre_compile.isstring(pattern):
292 raise TypeError("first argument must be string or compiled pattern")
--> 293 p = sre_compile.compile(pattern, flags)
294 if not (flags & DEBUG):
295 if len(_cache) >= _MAXCACHE:
/mnt/lovelace/software/anaconda/envs/py35/lib/python3.5/sre_compile.py in compile(p, flags)
534 if isstring(p):
535 pattern = p
--> 536 p = sre_parse.parse(p, flags)
537 else:
538 pattern = None
/mnt/lovelace/software/anaconda/envs/py35/lib/python3.5/sre_parse.py in parse(str, flags, pattern)
827 pattern.str = str
828
--> 829 p = _parse_sub(source, pattern, 0)
830 p.pattern.flags = fix_flags(str, p.pattern.flags)
831
/mnt/lovelace/software/anaconda/envs/py35/lib/python3.5/sre_parse.py in _parse_sub(source, state, nested)
435 start = source.tell()
436 while True:
--> 437 itemsappend(_parse(source, state))
438 if not sourcematch("|"):
439 break
/mnt/lovelace/software/anaconda/envs/py35/lib/python3.5/sre_parse.py in _parse(source, state)
639 if item[0][0] in _REPEATCODES:
640 raise source.error("multiple repeat",
--> 641 source.tell() - here + len(this))
642 if sourcematch("?"):
643 subpattern[-1] = (MIN_REPEAT, (min, max, item))
error: multiple repeat at position 6 |
|