Quantcast
Channel: Linux by Examples » python
Browsing all 10 articles
Browse latest View live

Python: Threading Callback Timer

It is very common that we need to run certain routines periodically, thats why in *nix environment we have cron and in windows OS we have task scheduler. But there comes a time, we may need to execute...

View Article



Image may be NSFW.
Clik here to view.

Python: Generating graphs with matplotlib

Matplotlib is a python 2D plotting library that can produce dots lines, histograms, power spectra, bar charts, pie charts, scatterplots, etc. With few lines of codes, you can generate quality graphs...

View Article

Python vs Lua, data structure

In python, we have various type of data structure, such as list, set, tuple, dictionary etc, but in Lua, we only have table. Table in Lua can be used as array, list, dictionary or object. Let see how...

View Article

python: writing binary file

Python is the best scripting language which I found it out perform Bash script as well as Lua. I like python’s scripting syntax, which is make sense and very convenient in string manipulations. Its now...

View Article

Python: Manipulate string or binary bytes with StringIO

Sometimes it is not convenient to construct string using equal (=) like this: str = "Hello, " ... str = str + "my name is " ... str = str + Name print str In python, we have string stream (StringIO)...

View Article


How can I avoid running a python script multiple times? Implement file locking.

Sometimes we just need a single instance of the python script to run at a time. Meaning, the python script itself should detects whether any instances of himself are still running and act accordingly....

View Article

Bit shifting can be done in python just like in c

It was amazing to discover that I can do bit shifting in python just like in c, the syntax makes no different at all. Let us look at how easy I can do a bit shifting. I write an example loop by...

View Article

python: simple http server for file sharing

You do not need to setup apache server just to hosting your file for sharing. If you have python 2.5 and above, you can do this at the targeted directory to share. python -m SimpleHTTPServer 9914 9914...

View Article


Does scons outperforms autoconf and makefiles?

SCons is a software construction tool (build tool, or make tool) implemented in Python, that uses Python scripts as “configuration files” for software builds. Based on the design that won the Software...

View Article


Serialize INI configuration to python dictionary

A lots of configuration file is in the format of INI, if we manage to serialize INI configuration to python dictionary, we can write python scripts to analyse and generate back to INI files. Below is...

View Article
Browsing all 10 articles
Browse latest View live




Latest Images