module pycode.open_script_file

Short summary

module pyquickhelper.pycode.open_script_file

A function to read a script and reading the encoding on the first line.

source on GitHub

Functions

function

truncated documentation

detect_encoding

guess the encoding from # -*- coding: ...

open_script

open a filename but read the encoding from the first line

Documentation

A function to read a script and reading the encoding on the first line.

source on GitHub

pyquickhelper.pycode.open_script_file.detect_encoding(filename)[source][source]

guess the encoding from # -*- coding: ...

Parameters

filename – filename

Returns

encoding or None

source on GitHub

pyquickhelper.pycode.open_script_file.open_script(filename, mode='r')[source][source]

open a filename but read the encoding from the first line

Parameters
  • filename – filename

  • mode – r, only r

Returns

stream

source on GitHub