control.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:BackgroundChecker 作者: ShyamW 项目源码 文件源码
def print_posts(self):
        with open('../data/index.html', 'w') as f:
            for post in self.model1.reddit_post_list:
                date = str(datetime.fromtimestamp(post.created_utc))
                post_url = post.link_url + post.id
                post_karma = str(post.score)
                f.write('<h3 style="color: #5e9ca0; display: inline;">' + 'username:&nbsp;&nbsp' +
                        self.model1.reddit_username + '&emsp;&emsp;</h3>\n')
                f.write('<h3 style="color: #5e9ca0; display: inline;">' + 'date:&nbsp&nbsp' + date + '&emsp;&emsp;' +
                        'karma:&nbsp&nbsp' + post_karma + '&emsp;</h3>\n')
                f.write('<p style="color: #5e9ca0; display: inline;"><a href="' + post_url + '"><img\n')
                f.write('src="https://cdn4.iconfinder.com/data/icons/web-links/512/41-512.png" alt="" '
                        'width="14" height="14" /></a></p>')
                f.write('<div class="md">\n')
                f.write(post.body_html.encode('utf-8') + '\n')
                f.write('</div>\n<hr />\n')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号