長さが&の文字列を解析したいと思います。例えば '(10,2)'です。長さは&の精度が必要です。私は以下を試みたが、それは、行の先頭から検索regexを使ってpython3で文字列を解析する
>>> import re
>>> my_str = 'numeric(10,2)'
>>> m = re.match(r'\d+,\d+', my_str)
>>> m
>>> m = re.match(r'(\d+,\d+)', my_str)
>>> m
>>> m = re.match('\((+d),(+d)\)', my_str)
>>> m = re.match('\((+d),(+d)\)', my_str)
Traceback (most recent call last):
は、詳細はこの記事を読んでhttp://stackoverflow.com/questions/180986/what-is-the-difference-between-pythons-re-search-and-再照合 – Kasramvd
とドキュメントhttps://docs.python.org/3/library/re.html#search-vs-match – Kasramvd
@ Kasramvd参考にしていただきありがとうございます。 – n33rma