Tony Tan tonytan748.github.io
1.

how to change between in string and bytes in pyhton

123456789x = 'abc'# string to bytesb = bytes(x, encoding='utf-8')#butes to strs = str(b, encoding='utf-8')
2.

Enhance your Python with an interactive shell

Original source is here The Python programming language has become one of the most popular languages used in IT. One reason for this success is it can be used to solve a variety...
3.

Mocks and monkeypatching in python

Translate from krzysztofzuraw First of all, what I want to accomplish here is to give you basic examples of how to mock data using two tools: mock and pytest monkeypatch. Why bo...
4.

Nevwe Write For-Loops Again

Translate from Randy Daw-Ran Liou This is a challenge. I challenge you to avoid writing for-loops in every scenario. Also, I challenge you to find the scenarios that are so fre...
5.

2 ways to get subprocess result in multiprocessing pool

Get the result when running subprocess, close it if the result is True123456789101112131415161718192021222324from multiproceeing import Poolimport Queueimport timedef test(p): ...
6.

Creating a multiprocessing Downloader App

12345678910111213141516171819202122232425262728293031323334import multiprocessingimport osimport requestsclass MultiProcDownloader(object): def __init__(self, urls): s...
7.

A multiprocessing tutorial

this blog translate from http://www.blog.pythonlibrary.org/2016/08/02/python-201-a-multiprocessing-tutorial/ The multiprocessing module was added to Python in version 2.6. It wa...
8.

Building a simple workflow engine in Python

this blog translate from http://supercoderz.in/building-a-simple-workflow-engine-in-python/ In my last post I described how a workflow engine works and the various key parts of ...
9.

12 Useful Pandas Techniques in Python for Data Manipulation

12 Useful Pandas Techniques in Python for Data Manipulation IntroductionPython is fast becoming the preferred language for data scientists – and for good reasons. It provides th...
10.

Prtfect Single Code for Python

some coding for python which one line to finish a common Product 2 for every element in list 1print map(lambda x:x*2, range(1,11)) Sum of all elements in list 1print sum(ran...