python SendMail 发送邮件
最近在学习python 时,用到了发送邮件的操作,通过整理总结如下:
一、相关模块介绍
发送邮件主要用到了smtplib和email两个模块,这里首先就两个模块进行一下简单的介绍:
smtplib模块
smtplib.SMTP([host[, port[, local_hostname[, timeout]]]])
SMTP类构造函数,表示与SMTP服务器之间的连接,通过这个连接可以向smtp服务器发送指令,执行相关操作(如:登陆、发送邮件)。所有参数都是可选的。
host:smtp服务器主机名
port:smtp服务的端口,默认是25;如果在创建SMTP对象的时候提供了这两个参数,在初始化的时候会自动调用connect方法去连接服务器。
smtplib模块还提供了SMTP_SSL类和LMTP类,对它们的操作与SMTP基本一致。
smtplib.SMTP提供的方法:
SMTP.set_debuglevel(level):设置是否为调试模式。默认为False,即非调试模式,表示不输出任何调试信息。
SMTP.connect([host[, port]]):连接到指定的smtp服务器。参数分别表示smpt主机和端口。注意: 也可以在host参数中指定端口号(如:smpt.yeah.net:25),这样就没必要给出port参数。
SMTP.docmd(cmd[, argstring]):向smtp服务器发送指令。可选参数argstring表示指令的参数。
SMTP.helo([hostname]) :使用"helo"指令向服务器确认身份。相当于告诉smtp服务器“我是谁”。
SMTP.has_extn(name):判断指定名称在服务器邮件列表中是否存在。出于安全考虑,smtp服务器往往屏蔽了该指令。
SMTP.verify(address) :判断指定邮件地址是否在服务器中存在。出于安全考虑,smtp服务器往往屏蔽了该指令。
SMTP.login(user, password) :登陆到smtp服务器。现在几乎所有的smtp服务器,都必须在验证用户信息合法之后才允许发送邮件。
SMTP.sendmail(from_addr, to_addrs, msg[, mail_options, rcpt_options]) :发送邮件。这里要注意一下第三个参数,msg是字符串,表示邮件。我们知道邮件一般由标题,发信人,收件人,邮件内容,
附件等构成,发送邮件的时候,要注意msg的格式。这个格式就是smtp协议中定义的格式。
SMTP.quit() :断开与smtp服务器的连接,相当于发送"quit"指令。(很多程序中都用到了smtp.close(),具体与quit的区别google了一下,也没找到答案。)
email模块
emial模块用来处理邮件消息,包括MIME和其他基于RFC 2822 的消息文档。使用这些模块来定义邮件的内容,是非常简单的。其包括的类有(更加详细的介绍可见:http://docs.python.org/library/email.mime.html):
class email.mime.base.MIMEBase(_maintype, _subtype, **_params):这是MIME的一个基类。一般不需要在使用时创建实例。其中_maintype是内容类型,如text或者image。
_subtype是内容的minor type 类型,如plain或者gif。 **_params是一个字典,直接传递给Message.add_header()。
class email.mime.multipart.MIMEMultipart([_subtype[, boundary[, _subparts[, _params]]]]:MIMEBase的一个子类,多个MIME对象的集合,_subtype默认值为mixed。boundary是MIMEMultipart的边界,默认边界是可数的。
class email.mime.application.MIMEApplication(_data[, _subtype[, _encoder[, **_params]]]):MIMEMultipart的一个子类。
class email.mime.audio. MIMEAudio(_audiodata[, _subtype[, _encoder[, **_params]]]): MIME音频对象
class email.mime.image.MIMEImage(_imagedata[, _subtype[, _encoder[, **_params]]]):MIME二进制文件对象。
二、普通文本邮件
普通文本邮件发送的实现,关键是要将MIMEText中_subtype设置为plain,首先导入smtplib和mimetext,创建smtplib.smtp实例,connect邮件smtp服务器,login后发送,具体代码如下:(python2.7下实现)
具体代码如下:
二、html邮件的发送
与text邮件不同之处就是将将MIMEText中_subtype设置为html。具体代码如下:(python2.7下实现)
三、发送带附件的邮件
发送带附件的邮件,首先要创建MIMEMultipart()实例,然后构造附件,如果有多个附件,可依次构造,最后利用smtplib.smtp发送。
def SendMailAttach(self, mail_tolist, mail_subject, mail_body, fileList, mail_cclist):
'''
发送带附件的邮件
:param mail_tolist: 接收者邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com']
:param mail_subject: 邮件主题
:param mail_body: 邮件体主题内容
:param fileList: 附件列表,就文件名列表(包含路径)
:param mail_cclist: 抄送邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com'],默认不传
:param mail_bcclist: 密送邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com'],默认不传
:return:
'''
msg = MIMEMultipart()
message = MIMEText(mail_body, _subtype='plain', _charset='utf-8')
msg.attach(message) # 构造附件
for f in fileList:
if os.path.isfile(f):
att = MIMEText(open(f, 'rb').read(), 'base64', 'utf-8')
att["Content-Type"] = 'application/octet-stream'
att["Content-Disposition"] = 'attachment;filename=' + os.path.basename(f)
msg.attach(att) msg['Subject'] = mail_subject
msg['From'] = self.mail_sender
msg['To'] = ",".join(mail_tolist)
if len(mail_cclist) > 0:
msg['Cc'] = ",".join(mail_cclist)
mail_tolist.extend(mail_cclist)
# if len(mail_bcclist) > 0:
# msg['Bcc'] = ",".join(mail_bcclist)
# mail_tolist.extend(mail_bcclist) message = ''
try:
server = smtplib.SMTP()
server.connect(self.mail_host)
server.login(self.mail_user, self.mail_pass)
server.sendmail(self.mail_sender, mail_tolist, msg.as_string())
server.close()
result = '邮件发送成功' except smtplib.SMTPException as e:
# print "Error: 无法发送邮件", e
message = 'Error: 无法发送邮件:'
return message
四、完整的代码如
# -*- coding: UTF-8 -*-
import os
import smtplib
import time
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.image import MIMEImage
import mail_setting class Mail:
'''
self.mail_host = "smtp.sina.com" # 设置服务器
self.mail_user = "xiaowang" # 用户名
self.mail_pass = "XXXXX" # 口令
self.mail_sender = 'xiaowang@sina.com' # 发送者
''' def __init__(self, mail_host="210.77.136.200", mail_user="user", mail_pass="pass",
mail_sender="da山<das@ctrchina.cn>", port=465):
# 第三方 SMTP 服务
self.mail_host = mail_host
self.mail_user = mail_user
self.mail_pass = mail_pass
self.mail_sender = mail_sender
self.port = port def SendHtmlMail(self, mail_tolist, mail_subject, mail_body, fileList, mail_cclist, mail_bcclist):
'''
发送Html邮件
:param mail_tolist: 接收者邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com']
:param mail_subject: 邮件主题
:param mail_body: 邮件体主题内容
:param fileList: 附件列表,就文件名列表(包含路径)
:param mail_cclist: 抄送邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com'],默认不传
:param mail_bcclist: 密送邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com'],默认不传
:return:
'''
message = MIMEText(mail_body, _subtype='html', _charset='gb2312')
message['Subject'] = mail_subject
message['From'] = self.mail_sender
if len(mail_cclist) > 0:
message['Cc'] = ",".join(mail_cclist)
mail_tolist.extend(mail_cclist)
if len(mail_bcclist) > 0:
message['Bcc'] = ",".join(mail_bcclist)
mail_tolist.extend(mail_bcclist) try:
smtpObj = smtplib.SMTP(self.mail_host, self.port)
# smtpObj.connect(self.mail_host, 25) # 25 为 SMTP 端口号
# smtpObj.login(self.mail_user, self.mail_pass)
smtpObj.sendmail(self.mail_sender, mail_tolist, message.as_string())
smtpObj.close()
print("邮件发送成功")
except smtplib.SMTPException as e:
print("Error: 无法发送邮件") def SendMailAttach(self, mail_tolist, mail_subject, mail_body, fileList, mail_cclist):
'''
发送带附件的邮件
:param mail_tolist: 接收者邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com']
:param mail_subject: 邮件主题
:param mail_body: 邮件体主题内容
:param fileList: 附件列表,就文件名列表(包含路径)
:param mail_cclist: 抄送邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com'],默认不传
:param mail_bcclist: 密送邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com'],默认不传
:return:
'''
msg = MIMEMultipart()
message = MIMEText(mail_body, _subtype='plain', _charset='utf-8')
msg.attach(message) # 构造附件
for f in fileList:
if os.path.isfile(f):
att = MIMEText(open(f, 'rb').read(), 'base64', 'utf-8')
att["Content-Type"] = 'application/octet-stream'
att["Content-Disposition"] = 'attachment;filename=' + os.path.basename(f)
msg.attach(att) msg['Subject'] = mail_subject
msg['From'] = self.mail_sender
msg['To'] = ",".join(mail_tolist)
if len(mail_cclist) > 0:
msg['Cc'] = ",".join(mail_cclist)
mail_tolist.extend(mail_cclist)
# if len(mail_bcclist) > 0:
# msg['Bcc'] = ",".join(mail_bcclist)
# mail_tolist.extend(mail_bcclist) message = ''
try:
server = smtplib.SMTP()
server.connect(self.mail_host)
server.login(self.mail_user, self.mail_pass)
server.sendmail(self.mail_sender, mail_tolist, msg.as_string())
server.close()
result = '邮件发送成功' except smtplib.SMTPException as e:
# print "Error: 无法发送邮件", e
message = 'Error: 无法发送邮件:'
return message def SendMail(self, mail_subject, mail_body, mail_tolist,mail_cclist):
'''
发送普通邮件
:param mail_tolist: 接收者邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com']
:param mail_subject: 邮件主题
:param mail_body: 邮件体主题内容
:param fileList: 附件列表,就文件名列表(包含路径)
:param mail_cclist: 抄送邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com'],默认不传
:param mail_bcclist: 密送邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com'],默认不传
:return:
'''
message = MIMEText(mail_body, _subtype='plain', _charset='utf-8')
message['Subject'] = mail_subject
message['From'] = self.mail_sender
if mail_tolist:
message['To'] = ",".join(mail_tolist)
if len(mail_cclist) > 0:
message['Cc'] = ",".join(mail_cclist)
mail_tolist.extend(mail_cclist) result = ''
try:
server = smtplib.SMTP()
server.connect(self.mail_host)
server.login(self.mail_user,self.mail_pass)
server.sendmail(self.mail_sender, mail_tolist, message.as_string())
server.close()
result = '邮件发送成功'
# print "邮件发送成功"
except smtplib.SMTPException as e:
result = 'Error: 无法发送邮件'
return result def test(self,mail_body,mail_subject,mail_sendto_user,fileName): fileList = []
fileList.append(fileName) mail_tolist = []
mail_tolist.append(mail_sendto_user) # 多个人,中间用逗号分隔
# cc_tolist = ['xx<aa@CTRCHINA.CN>','dd<dd@CTRCHINA.CN>']
cc_tolist =[]
mail_bcclist = [] # result = self.SendMail( mail_subject, mail_body, mail_tolist,cc_tolist)
result = self.SendMailAttach(mail_tolist,mail_subject, mail_body,fileList, cc_tolist)
return result setobj = mail_setting.mail_setting()
m = Mail(setobj.mail_host,setobj.mail_user,setobj.mail_pass,setobj.mail_send_user,setobj.port)
# result = m.test('信息1',u'小测试测试',setobj.mail_receive_user)
fileName="D:\\work\\python36_crawl\\src\\2018-07-02-14-01-55.csv"
result = m.test('信息1',u'小测试测试',setobj.mail_receive_user,fileName)
print (result)
# -*- coding: utf-8 -*-
# 配置文件类 class mail_setting:
def __init__(self): #由于机器端口控制,目前只能用公司邮箱
# 邮件端口
# self.port = 465
self.port = 465 # 邮件服务器地址
self.mail_host = '210.77.136.200' # 接收人邮件地址(需要修改)改成你自己的,发送人和接收人可以用一个地址
self.mail_receive_user = '360648011@qq.com' # self.mail_receive_user = 'shaodd@sina.com' # 发送人邮件地址(需要修改)改成你自己的,
self.mail_send_user='user@ctrchina.cn' #邮件登录用户名 (需要修改)
self.mail_user = 'user' # 登录用密码(需要修改)
self.mail_pass = "password"
另一例子
from email import encoders
from email.header import Header
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.utils import parseaddr,formataddr
import smtplib
import os
# 最终结果通过Email发送
def _format_addr(s):
name, addr = parseaddr(s)
return formataddr((Header(name,'utf-8').encode(),addr)) def Me_email(from_addr,password,to_addr,smtp_server,title,mail_body,fileList):
# msg = MIMEText('%s' % (result),'plain','utf-8') # 邮件显示内容
msg = MIMEMultipart()
message = MIMEText(mail_body, _subtype='plain', _charset='utf-8')
msg.attach(message)
msg['From'] = _format_addr('ICTR <%s>' % from_addr) # 邮件发送人
# msg['To'] = _format_addr('管理员 <%s>' % to_addr)
msg['To']="289061792@qq.com,334028056@qq.com"
msg['Cc'] = "aaa1@ctrchina.cn"
# msg['To'] = _format_addr('360648056@qq.com')
msg['Subject'] = Header('%s' % (title),'utf-8').encode() # 邮件title
for f in fileList:
if os.path.isfile(f):
att = MIMEText(open(f, 'rb').read(), 'base64', 'utf-8')
att["Content-Type"] = 'application/octet-stream'
att["Content-Disposition"] = 'attachment;filename=' + os.path.basename(f)
msg.attach(att)
server = smtplib.SMTP(smtp_server,587)
server.set_debuglevel(1)
server.login(from_addr,password)
# server.sendmail(from_addr,[to_addr,'289061791@qq.com','360648056@qq.com'],msg.as_string())
lst ="shaoks@ctrchina.cn,289061791@qq.com,360648056@qq.com".split(',')
server.sendmail(from_addr, lst, msg.as_string())
server.quit() # for f in fileList:
# if os.path.isfile(f):
# att = MIMEText(open(f, 'rb').read(), 'base64', 'utf-8')
# att["Content-Type"] = 'application/octet-stream'
# att["Content-Disposition"] = 'attachment;filename=' + os.path.basename(f)
# msg.attach(att)
# 输入Email地址和口令
from_addr = 'xx@ctrchina.CN' # 发送邮件的邮箱账号
password = '@8ddr' # 发送邮件的邮箱密码,无需提供
to_addr = 'shaoks@ctrchina.cn' # 接收邮件的邮箱账号
smtp_server = '211.71.136.200' # 发送邮件邮箱的STMP服务器地址
title = '金融时报和第一财经日报今天数据'
mail_body = '问好:\n\n 附件是金融时报和第一财经日报今天的采集数据\n\n 有问题,请及时联系,谢谢。' fileList = [] fileName = "E:\\News\\2018-09-28.csv"
fileList.append(fileName)
fileName = "E:\\News\\2018-09-29.csv"
fileList.append(fileName)
Me_email(from_addr,password,to_addr,smtp_server,title,mail_body,fileList)
from email import encoders
from email.header import Header
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.utils import parseaddr,formataddr
import smtplib
import datetime
import os
import mail_setting class Mail:
def __init__(self):
pass def init(self):
setobj = mail_setting.mail_setting()
# 邮件服务器IP
self.mail_host = setobj.mail_host
# 邮件服务器端口:587
self.port = setobj.mail_port
# 发送人
self.mail_send = setobj.mail_send
# 邮件发送人登录密码
self.mail_pass = setobj.mail_pass
# 介绍人,多个以逗号分隔
self.mail_receive = str(setobj.mail_receive)
# 抄送,多个以逗号分隔
self.mail_chao = str(setobj.mail_chao)
# 邮件主题内容
self.mail_subject = setobj.mail_subject
# 邮件体内容
self.mail_body = setobj.mail_body
# 发送的附件路径
self.attachmentFileDir = setobj.attachmentFileDir
# 最终结果通过Email发送 def _format_addr(self, s):
name, addr = parseaddr(s)
return formataddr((Header(name, 'utf-8').encode(), addr)) def Me_email(self, from_addr, password, to_addr, to_chao, smtp_server, title, mail_body, fileList):
# msg = MIMEText('%s' % (result),'plain','utf-8') # 邮件显示内容
msg = MIMEMultipart()
message = MIMEText(mail_body, _subtype='plain', _charset='utf-8')
msg.attach(message)
msg['From'] = self._format_addr('ICTR <%s>' % from_addr) # 邮件发送人
# msg['To'] = _format_addr('管理员 <%s>' % to_addr)
msg['To'] = to_addr
if to_chao:
msg['Cc'] = to_chao
msg['Subject'] = Header('%s' % (title), 'utf-8').encode() # 邮件title
for f in fileList:
if os.path.isfile(f):
att = MIMEText(open(f, 'rb').read(), 'base64', 'utf-8')
att["Content-Type"] = 'application/octet-stream'
att.add_header('Content-Disposition', 'attachment', filename=('gbk', '', os.path.basename(f)))
msg.attach(att)
server = smtplib.SMTP(smtp_server, 587)
# server.set_debuglevel(1)
server.login(from_addr, password)
# server.sendmail(from_addr,[to_addr,'22906172@qq.com','333348056@qq.com'],msg.as_string())
lst = "xx@ctrchina.cn,22906172@qq.com,333348056@qq.com".split(',')
server.sendmail(from_addr, lst, msg.as_string())
server.quit() def SendMail(self, mail_tolist, mail_cclist, fileList):
''' 发送邮件
:param mail_tolist: 接收者邮件列表,如:['xiaoli@sina.com','xiaoMa@qq.com']
:param mail_cclist: 抄送列表,同上
:param fileList: 文件列表,同上
'''
try:
msg = MIMEMultipart()
message = MIMEText(self.mail_body, _subtype='plain', _charset='utf-8')
msg.attach(message)
msg['Subject'] = self.mail_subject
msg['From'] = self._format_addr('ICTR <%s>' % self.mail_send) if mail_tolist:
msg['To'] = ",".join(mail_tolist)
if len(mail_cclist) > 0:
msg['Cc'] = ",".join(mail_cclist)
mail_tolist.extend(mail_cclist) if fileList:
for f in fileList:
if os.path.isfile(f):
att = MIMEText(open(f, 'rb').read(), 'base64', 'utf-8')
att["Content-Type"] = 'application/octet-stream'
att.add_header('Content-Disposition', 'attachment', filename=('gbk', '', os.path.basename(f)))
msg.attach(att) server = smtplib.SMTP(self.mail_host, self.port)
# 调试状态设置
# server.set_debuglevel(1)
server.login(self.mail_send, self.mail_pass)
server.sendmail(self.mail_send, mail_tolist, msg.as_string())
server.quit()
except smtplib.SMTPException as e:
print("Error: 无法发送邮件") def test(self):
self.init() fileList = []
dt = datetime.datetime.now().strftime("%Y-%m-%d")
fileName = '金融时报_' + dt + '.csv'
fileName = os.path.join(self.attachmentFileDir, fileName)
if os.path.exists(fileName):
fileList.append(fileName) fileName = '第一财经日报_' + dt + '.csv'
fileName = os.path.join(self.attachmentFileDir, fileName)
if os.path.exists(fileName):
fileList.append(fileName) # 如果没有附件就不发邮件
if fileList:
mail_tolist = []
if self.mail_receive.find(",") > 0:
users = self.mail_receive.split(",")
for user in users:
mail_tolist.append(user)
else:
mail_tolist.append(self.mail_receive) mail_cclist = []
if self.mail_chao:
if self.mail_chao.find(",") > 0:
users = self.mail_chao.split(",")
for user in users:
mail_cclist.append(user)
else:
mail_cclist.append(self.mail_chao) self.SendMail(mail_tolist, mail_cclist, fileList)
python SendMail 发送邮件的更多相关文章
- python大法好——Python SMTP发送邮件
Python SMTP发送邮件 SMTP(Simple Mail Transfer Protocol)即简单邮件传输协议,它是一组用于由源地址到目的地址传送邮件的规则,由它来控制信件的中转方式. py ...
- Python——SMTP发送邮件
一.定义 SMTP(Simple Mail Transfer Protocol)即简单邮件传输协议,它是一组用于由源地址到目的地址传送邮件的规则,由它来控制信件的中转方式.python的smtplib ...
- 用Python自动发送邮件
用Python自动发送邮件 最近需要在服务器上处理一些耗时比较长的任务,因此想到利用python写一个自动发送邮件的脚本,在任务执行完毕后发送邮件通知我.以下代码以163邮箱为例: 开通163 ...
- python之发送邮件~
在之前的工作中,测试web界面产生的报告是自动使用python中发送邮件模块实现,在全部自动化测试完成之后,把报告自动发送给相关人员 其实在python中很好实现,一个是smtplib和mail俩个模 ...
- Appium+python 自动发送邮件(1)(转)
(原文:https://www.cnblogs.com/fancy0158/p/10056091.html) SMTP:简单传输协议,实在Internet上传输Email的事实标准. Python的s ...
- Linux sendmail发送邮件失败诊断案例(一)
在新服务器上测试sendmail发送邮件时,发现邮件发送不成功,检查日志文件发现如下错误(Notice:由于涉及公司服务器,邮箱等,故下面hostname.邮箱地址等信息使用xxx代替) tail - ...
- Linux SendMail发送邮件失败诊断案例(二)
Linux上Sendmail经常由于一些配置问题,导致邮件发送失败,下面整理.收集了一些邮件发送失败.异常的案例. 案例1:在新服务器上测试sendmail发送邮件时,发现邮件发送不成功,检查/var ...
- Linux SendMail发送邮件失败诊断案例(三)
一Linux服务器突然发送不出邮件,检查了很多地方都没有发现异常,检查/var/log/maillog发现如下具体信息: Apr 12 00:36:04 mylinux sendmail[4685]: ...
- linux利用sendmail发送邮件的方法
Linux利用sendmail发送邮件, 方法1 安装sendmail即可使用, mail -s "test" user@sohu.com bin/mail会默认使用本地sendm ...
随机推荐
- Oracle中的内置函数在sql中的转换整理
程序里面经常会即支持Oracle数据库,又支持sql数据库.而有些Oracle内置函数用的比较多,但在sql中语法有些不同,我做了些整理,希望可以帮助大家.... 1.oracle中的内置函数:ora ...
- CSS之密码强度检测
输入密码后单击空白处即可检测. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "ht ...
- ios中的事件处理、响应者链条以及第一响应者
在ios中,事件UIEvent类来表示,当一个事件发生时,系统会搜集的相关事件信息,创建一个UIEvent对象,最后将该事件转发给应用程序对象(UIApplication).日常生活中,主要有三种类型 ...
- python简单爬虫编写
1.主要学习这程序的编写思路 a.读取解释网站 b.找到相关页 c.找到图片链接的元素 d.保存图片到文件夹 ..... 将每一个步骤都分解出来,然后用函数去实现,代码易读性高. ##代码尽快运行时会 ...
- Android开发:碎片Fragment完全解析fragment_main.xml/activity_main.xml(转)
注明:这个转的,见谅未能标明原始出处 我们都知道,Android上的界面展示都是通过Activity实现的,Activity实在是太常用了,我相信大家都已经非常熟悉了,这里就不再赘述. 但是Activ ...
- HIV T2
甲学者将HIV病毒的遗传物质彻底水解后得到A.B.C三种化合物,乙学者将组成T2噬菌体的遗传物质彻底水解后得到了A.B.D三种化合物.你认为C.D两种化合物分别指的是 A.尿嘧啶.胸腺嘧啶 B.胸腺嘧 ...
- Standford CoreNLP
Stanford CoreNLP Stanford CoreNLP提供一组自然语言处理的工具.这些工具可以把原始英语文本作为输入,输出词的基本形式,词的词性标记,判断词是否是公司名.人名等,规格化日期 ...
- Mac 如何恢复出厂设置
首先将电脑关机然后按电源键启动启动的时候电脑会出现白色什么都没有的界面这时按住 option(alt)键会出现磁盘选择界面然后选择一个叫 Reocorvry10.X.X的硬盘点击那个硬盘按照上面的指示 ...
- 清空系统日志shell scripts——自学笔记
这是一个清空系统日志的脚本: vim logmess_clean.sh #bin/bash //该脚本所使用的shell解释器 cd /var/log/ //切换到存放日志目录 ech ...
- 第四届蓝桥杯C/C++A组题目:振兴中华
首先把题目贴上来吧! 小明参加了学校的趣味运动会,其中的一个项目是:跳格子. 地上画着一些格子,每个格子里写一个字,如下所示:(也可参见图1) 从我做起振 我做起振兴 做起振兴中 起振兴中华 图1 比 ...