[Python] open_exel_file — getting "TypeError: unicode error"

Discussão em 'Python' iniciado por Stack, Abril 27, 2025.

  1. Stack

    Stack Membro Participativo

    I'm new to learning Python, and when I try to open_exel_file, I get this error:

    SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape


    Code

    import pandas as pd

    def open_excel_file(A):
    df = pd.read_excel(A)
    return df

    filename = r'C:\Users\kavak\Desktop\1\AdjustedNetSavings.xlsx'
    excel_data = open_excel_file(filename)
    print(excel_data)

    Continue reading...

Compartilhe esta Página