PydPiper / pylightxl

A light weight, zero dependency, minimal functionality excel read/writer python library
https://pylightxl.readthedocs.io
MIT License
302 stars 47 forks source link

Handle the encoding in the csv file #95

Open LeonardVertighel opened 1 year ago

LeonardVertighel commented 1 year ago

Pylightxl Version: 1.61 Python Version: 3.9.2 Operative system: Linux Debian 11

Summary of Feature: Insert parameter to handle file encoding when working with csvs

Traceback: No traceback available

Suggestion for fix: Reading:

def readcsv(fn, delimiter=',', ws='Sheet1', encoding='utf-8'):
    ...
    ...
    f = fn if 'readline' in dir(fn) else open(fn, 'r', encoding=encoding)
    ...

Writing:


def writecsv(db, fn, ws=(), delimiter=',', encoding='utf-8'):
     ...
     ...
     f = open(new_fn, 'w', encoding=encoding)
     ...