Commit 1b8a261a by sy520518

lesson4

parents
"""
书写邮箱和手机号码匹配的正则
新浪:@sina.com、@sina.cn
网易:@163.com、@126.com、@163.net、@188.com
Yeah邮箱:@yeah.net
谷歌:@gmail.com、@googlemail.com
Microsoft:@hotmail.com
雅虎:@yahoo.com
新浪:@sina.com
搜狐:@sohu.com
Tom:@tom.com
21CN邮箱:@21cn.com
腾讯:@qq.com
263邮箱:@263.net
"""
import re
email = input("请输入邮箱进行验证:")
reg = "(^[a-zA-Z0-9\-]{5,16})@(((sina|163|188|qq|sohu|gmail|googlemail|hotmail|21cn|tom|yahoo)\.com)|((163|yeah|263)\.net)|(sina\.cn))"
result = re.findall(reg,email)
if result:
print("邮箱验证成功")
else:
print("邮箱验证失败")
\ No newline at end of file
"""
验证手机号
福建省:
移动:134、135、136、137、138、139、147、150、151、152、157、158、159、182、187、188、189
联通:130、131、132、145、155、156、186
电信:133、153、189
"""
import re
tel = input("请输入要验证的手机号:")
reg = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(18[2,6-9]))([0-9]{8})$"
try:
result = re.search(reg,tel).group(0)
#result = re.findall(reg,tel)
print("手机号验证成功")
except AttributeError:
print("手机号验证失败")
\ No newline at end of file
import aiml
k=aiml.Kernel()
k.learn("std-startup.xml")
k.respond("load aiml b")
while True:
print(k.respond(input("input >>")))
\ No newline at end of file
<aiml version="1.0.1" encoding ="UTF-8">
<category>
<pattern>你好</pattern>
<template>
你好~欢迎关注公众号【佛系学python】
</template>
</category>
<category>
<pattern>有微信群吗*</pattern>
<template>有的哟~进入公众号->点击“相关作者”->点击“微信群”->扫码进群</template>
</category>
<category>
<pattern>*谢谢*</pattern>
<template>不客气,嘻嘻~</template>
</category>
</aiml>
\ No newline at end of file
<aiml version="1.0.1" encoding = "UTF-8">
<category>
<pattern>LOAD AIML B</pattern>
<template>
<learn>basic_chat.aiml</learn>
</template>
</category>
</aiml>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment