Use the import + export tool and a text editor to replace a few data points.
- Export your posts to xml
- Use a text editor with a search + replace tool to replace a few fields
- Import the updated xml
# coding=utf-8 | |
def is_valid(input_): | |
"""validation rules""" | |
return input_ in '012345ABC' | |
while True: | |
choice = raw_input() | |
if is_valid(choice): | |
break |
# coding=utf-8 | |
import collections | |
data = {'one': 1, 'two': 2, 'three': 3, 'a': 2} | |
sorted_data = collections.OrderedDict(sorted(data.items())) | |
print sorted_data | |
print sorted_data['three'] |
url = 'https://www.reddit.com/r/learnpython/comments' \ | |
'/2ztwnt/how_to_use_string_questions_on_quotes_str_i_have/' | |
alt = ('https://www.reddit.com/r/learnpython/comments' | |
'/2ztwnt/how_to_use_string_questions_on_quotes_str_i_have/') |
#!/usr/bin/env python | |
# coding=utf-8 | |
""" | |
cache_requests | |
-------------- | |
This module implements a basic LRU decorator that syncs calls with a redislite database. | |
ELI5: If you call the same function with the same parameters, it does not recalculate | |
the function. Instead, the first time, the results are stored, the second time the |
# Python Libraries | |
import re | |
# Django Packages | |
from django import template | |
register = template.Library() | |
_re_camel_humps = re.compile('([a-z])([A-Z0-9])') | |
""" |
from functools import wraps | |
def defaults(method='__init__', **default_args): | |
"""Class decorator. Overrides method default arguments.""" | |
def decorate(cls): | |
func = getattr(cls, method) | |
@wraps(func) |
from setuptools import setup | |
from setuptools.command.test import test as TestCommand | |
class PyTest(TestCommand): | |
def finalize_options(self): | |
TestCommand.finalize_options(self) | |
self.test_args = [] | |
self.test_suite = True | |
def run_tests(self): |
from functools import reduce | |
def pipeline(steps, initial=None): | |
def apply(result, step): | |
yield from step(result) | |
yield from reduce(apply, steps, initial) | |
if __name__ == '__main__': | |
# BEFORE |
# /usr/bin/env python | |
# coding=utf-8 | |
from __future__ import print_function | |
import json | |
import os.path | |
import shutil | |
import subprocess | |
import sys | |
from argparse import ArgumentParser, FileType |