본문 바로가기

Python4

nl2br filter 개행 문자를 와 로 변경해 주는 필터 import re _paragraph_re = re.compile(r'(?:\r\n|\r|\n){2,}') def nl2br(value): return u'\n\n'.join(u'%s' % p.replace(u'\n', u' ') for p in _paragraph_re.split(value)) http://stackoverflow.com/questions/12521127/is-there-a-better-way-to-apply-a-nl2br-filter-with-jinja-flask 2013. 10. 2.
feed2html.py feed-to-HTML converter in Python feed2html.py를 사용하면 RSS/RDF/Atom feed를 HTML문서로 변화 할 수 있다. Using feed2html.py from the command line:% feed2html.py -h Usage: feed2html.py [options] Options: -D var=val Define variable equals to value. -h Display this help message. -i input Feed input. It can be an URL, a local file name, or '-' for standard input. (Default standard input) -o output HTML output. It can be a local file name, or '-' .. 2013. 10. 2.
Post using python script $ vi blog_post.py # Import needed libraries: import xmlrpclib; from pprint import pprint; # Define the blog publishing function def blogPost( server, username, password, categories, tags, title, content ): datastruct = {'description':content, 'title':title, 'categories':categories, 'mt_keywords':tags} returncode = server.metaWeblog.newPost('1',username,password,datastruct,1) print returncode ser.. 2009. 6. 4.
XML-RPC servers for Python XML-RPC servers Python also comes with SimpleXMLRPCServer, a module for implementing XML-RPC servers. You can register functions or instances with an instance of the SimpleXMLRPCServer class in the module of the same name, in order to expose XML-RPC services. The most straightforward way is to just write an instance with methods that do what you need, and then register this instance. However, in.. 2009. 6. 4.