0

我希望用户只输入十位数字而无需标点符号。我已经尝试过以下模式。在每种情况下,都会弹出一个窗口要求我“请匹配请求的格式”。我可能会切换到 jquery 解决方案,但我仍然很好奇为什么这不起作用?

感谢您的任何见解,苏

<label for="cellPhone">
            <g:message code="employees.cellPhone.label" default="Cell Phone" />
        </label>
        <g:field type="text" pattern="~/[0-9]{10}/" name="cellPhone1" placeholder="10-digit cell including area code" ></g:field>
        <g:field type="text" pattern="~[0-9]{10}" name="cellPhone2" placeholder="10-digit cell including area code" ></g:field>
        <g:field type="text" pattern="~/\\d{10}/" name="cellPhone3" placeholder="10-digit cell including area code" ></g:field>
        <g:field type="text" pattern="~\\d{10}" name="cellPhone4" placeholder="10-digit cell including area code" ></g:field>
        <g:field type="text" pattern="~/\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d/" name="cellPhone5" placeholder="10-digit cell including area code" ></g:field>
        <g:field type="text" pattern="~\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d" name="cellPhone6" placeholder="10-digit cell including area code" ></g:field>

在带有 BeautifulSoup 的 Python 3 中,print(soup.get_text()) 在以下代码中生成错误('NoneType' 对象不可调用):

此代码生成 NoneType 对象错误。“print(soup.get_text())”被指示为问题。我该如何解决?

import urllib
from BeautifulSoup import BeautifulSoup

base_url = "http://www.galactanet.com/oneoff/theegg_mod.html"

url = (base_url)
content = urllib.urlopen(url)
soup = BeautifulSoup(content)
print(soup.get_text())
4

1 回答 1

3

您不需要,~/因为这是客户端的事情

<g:field type="text"
         pattern="[0-9]{10}"
         name="cellPhone1"
         placeholder="10-digit cell including area code"/>
于 2013-08-08T21:45:06.800 回答