本文整理汇总了Python中nntplib.NNTP.stat方法的典型用法代码示例。如果您正苦于以下问题:Python NNTP.stat方法的具体用法?Python NNTP.stat怎么用?Python NNTP.stat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nntplib.NNTP
的用法示例。
在下文中一共展示了NNTP.stat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pair
# 需要导入模块: from nntplib import NNTP [as 别名]
# 或者: from nntplib.NNTP import stat [as 别名]
# over
'Return a pair (response, overviews). overviews is a list of (article_number, overview) tuples, one for each article selected by message_spec'
resp,overviews = s.over((last-1,last))
for num,over in overviews:
print(num)# 1-100
#print(over)
# print(over.keys())
# ['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', 'subject']
print(over.get('date'))
print(nntplib.decode_header(over.get('from')))
print(over.get('message-id'))
print(over.get('subject'))
# stat
'Return a triple (response, number, id) where number is the article number and id is the message id.'
resp,num,msg_id = s.stat(last)
print(num,msg_id)
# article
'Return a tuple (response, info) where info is a namedtuple with three attributes number, message_id and lines (in that order).'
print('-'*10)
resp,info = s.article(last)
print(info.number,info.message_id,len(info.lines))
# head
'Same as article(), but sends a HEAD command. The lines returned (or written to file) will only contain the message headers, not the body.'
print('-'*10)
resp,info = s.head(last)
print(info.number,info.message_id,len(info.lines))
# body