utils - Utility Functions

Mapping utilities.

write_json_to_file(filename, obj, indent=4)

Write the given object to the given filename in JSON format.

Parameters:
  • filename (string) – File to write.
  • obj (primitive, list, dict) – Simple (serializable) object to write.
  • indent (int) – Number of spaces to indent nested objects
read_json_from_file(filename)

Read a JSON object from filename and return it.

Parameter:filename (string) – File from which to read.
Returns:The object read from filename.
Return type:primitive, list, dict
ms_to_mph(meters_per_sec)

Converts meters per second to miles per hour.

Parameter:meters_per_sec (numeric) – Speed to be converted, in m/s
Returns:meters_per_sec converted to miles per hour.
Return type:float
load_module(filename)

Return a module object loaded from the given .py file.

This can load .pyc files, but you have to point it at the .py file.

Parameter:filename (string) – Filename (with optional path) of the .py file to load.
Returns:The module object specified by the given .py file.

Indices and tables

Table Of Contents

Previous topic

stats - Basic Descriptive Statistics

Next topic

Example Dynamic Web Site

This Page


Python Powered

Get CitySpeed at SourceForge.net. Fast, secure and Free Open Source software downloads