📚Cheatsheets

Cheatsheet collection for go, rust, python, shell and javascript.

How to read file to text in Python?

Simple way.

with open("package.json") as f:
    str_file = f.read()
    print(str_file)

Using custom encoding.

with open("package.json", encoding = 'utf-8') as f:
    str_file = f.read()
    print(str_file)