Python Virtual Environment – virtualenv

python

Chapter 174: Python Virtual Environment – virtualenv A Virtual Environment (“virtualenv”) is a tool to create isolated Python environments. It keeps the dependencies required by different projects in separate places, by creating virtual Python env for them. It solves the “project A depends on version 2.xxx but, project B needs 2.xxx” dilemma, and keeps your … Read more

Python Immutable datatypes(int, float, str, tuple and frozensets)

python

Python Immutable datatypes(int, float, str, tuple and frozensets) is another important parameter used by different programmers . Learn more about it here. Python Immutable datatypes: Individual characters of strings are not assignable foo = “bar”foo[0] = “c” # Error Immutable variable value can not be changed once they are created. Section 148.2: Tuple’s individual members … Read more

Python Sys Module Tutorial

python

The Python sys module provides access to functions and values concerning the program’s runtime environment, such as the command line parameters in sys.argv or the function sys.exit() to end the current process from any point in the program flow. While cleanly separated into a module, it’s actually built-in and as such will always be available … Read more

ChemPy – python package

Chapter 178: ChemPy – python package ChemPy is a python package designed mainly to solve and address problems in physical, analytical and inorganic Chemistry. It is a free, open-source Python toolkit for chemistry, chemical engineering, and materials science applications. Section 178.1: Parsing formulae from chempy import Substanceferricyanide = Substance.from_formula(‘Fe(CN)6-3’) ferricyanide.composition == {0: -3, 26: 1, … Read more

Python Audio Tutorial | Audio Module In Python Tutorial

python

Chapter 181: Audio Section 181.1: Working with WAV files winsound Windows environment import winsoundwinsound.PlaySound(“path_to_wav_file.wav”, winsound.SND_FILENAME) wave Support mono/stereo Doesn’t support compression/decompression import wavewith wave.open(“path_to_wav_file.wav”, “rb”) as wav_file: # Open WAV file in read-only mode. Get basic information. n_channels = wav_file.getnchannels() # Number of channels. (1=Mono, 2=Stereo).sample_width = wav_file.getsampwidth() # Sample width in bytes.framerate = wav_file.getframerate() … Read more

Python 2To3 Tool Tutorial | 2To3 Tool In Python Tutorial

Python 2to3 tool is another important parameter used by different programmers in performing different tasks. Learn more about it here. Python 2to3 tool Parameter filename / directory_name Option -f FIX, –fix=FIX -j PROCESSES, –processes=PROCESSES -x NOFIX, –nofix=NOFIX -l, –list-fixes-p, –print-function -v, –verbose –no-diffs -w -n, –nobackups -o OUTPUT_DIR, –output-dir=OUTPUT_DIR -W, –write-unchanged-files –add-suffix=ADD_SUFFIX Description 2to3 accepts … Read more

Python Pyaudio Tutorial | Pyaudio Module In Python Tutorial

Chapter 182: pyaudio PyAudio provides Python bindings for PortAudio, the cross-platform audio I/O library. With PyAudio, you can easily use Python to play and record audio on a variety of platforms. PyAudio is inspired by: 1.pyPortAudio/fastaudio: Python bindings for PortAudio v18 API. 2.tkSnack: cross-platform sound toolkit for Tcl/Tk and Python. Section 182.1: Callback Mode Audio … Read more

Python Unicode And Bytes Tutorial | Unicode And Bytes In Python

Game Development

Python Unicode and bytes are two different parameters used in encoding Parameter Detailsencoding The encoding to use, e.g. , , etc…’ascii’ ‘utf8’The errors mode, e.g. to replace bad characters with question marks, to ignoreerrors ‘replace’ ‘ignore’bad characters, etc… Python Unicode and bytes: Encoding/decoding error handling .encode and .decode both have error modes. The default is … Read more

Non-offcial Python implementations

Non-offcial Python implementations are another important thing to learn by Python programmers. Learn all you need to know about this module here. IronPython Open-source implementation for .NET and Mono written in C#, licensed under Apache License 2.0. It relies on DLR (Dynamic Language Runtime). It supports only version 2.7, version 3 is currently being developed. … Read more

Python ArcPy Tutorial | ArcPy Module In Python Tutorial

Python ArcPy is used to create a file and perform many other functions by using Python programming language. Learn more about it here. createDissolvedGDB to create a file gdb on the workspace def createDissolvedGDB(workspace, gdbName):gdb_name = workspace + “/” + gdbName + “.gdb”if(arcpy.Exists(gdb_name):arcpy.Delete_management(gdb_name)arcpy.CreateFileGDB_management(workspace, gdbName, “”)else:arcpy.CreateFileGDB_management(workspace, gdbName, “”)return gdb_name Python ArcPy: Printing one field’s value for … Read more

Python Abstract Base Classes (abc)

Python Abstract Base Classes (abc) are designed to inherit but avoid implementing specific methods. They only leave method signature. Learn more here. Setting the ABCMeta metaclass Abstract classes are classes that are meant to be inherited but avoid implementing specific methods, leaving behind only method signatures that subclasses must implement. Abstract classes are useful for … Read more

Python Attribute Access

Python Attribute Access is another important module to learn while programming in Python. This topic covers all you need to know about attribute access. Basic Attribute Access using the Dot Notation Let’s take a sample class. class Book:def init(self, title, author):self.title = titleself.author = authorbook1 = Book(title=”Right Ho, Jeeves”, author=”P.G. Wodehouse”) In Python you can … Read more