Python FAQ

Работа с текстом

Транслит с кириллицы на латиницу

import unidecode
print unidecode('текст на русском')

Преобразование кодировок в UTF-8

print unicode('текст в какой-то кодировке', 'UTF-8')

Преобразование содержимого файла file в UTF-8

import codecs
txtfile =, "r", "utf-8")
data =

Интересные библиотеки

3D / mesh

  1. stl_tools - generate STL geometry files from plain text, LaTeX code, and 2D numpy arrays (matrices)
  2. trimesh - import, export, process, analyze and view triangular meshes (Pre-install version: Blender and openSCAD are backends used for boolean operations, Import STEP files as meshes, Import and export 2D or 3D vector paths from/to DXF or SVG files...)
  3. pymesh - rapid prototyping platform focused on geometry processing

Interactive visualization library for web (html, jupyter-notebook)


  1. Bokeh - interactive visualization library
  2. mpld3 - Matplotlib in the browser (interactive data visualizations based on D3.js)


  1. networkx - complex networks
  2. jgraph - webGL graphs visualization in 3D
  3. graph-tool - module for manipulation and statistical analysis of graphs (a.k.a. networks)
  4. ETE Toolkit - framework to work with trees

Dashboard/Gantt/Process planning

  1. pyxley - library for developing lightweight dashboards (flask-based)


  1. memory_profiler - module for monitoring memory usage of a python program