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

Guesses 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]

Guesses 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]

Open a filename but read the encoding from the first line.

Parameters:
  • filename – filename

  • mode – r, only r

Returns:

stream

source on GitHub