w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Ambiguity in Unicode Syntax XlsxWriter Python 2 Module

I use the function decode.

tip = 'Haz clic aquí para acceder al fichero remoto.'
tip = tip.decode('utf-8')

One example to use decode in python 2

import xlsxwriter

# Create a new workbook and add a worksheet
workbook = xlsxwriter.Workbook('hyperlink.xlsx')
worksheet = workbook.add_worksheet('Hyperlinks')

# Format the first column
worksheet.set_column('A:A', 30)

# Add the standard url link format.
url_format = workbook.add_format({
        'font_color': 'blue',
        'underline':  1
})

# Add a sample alternative link format.
red_format = workbook.add_format({
        'font_color': 'red',
        'bold':       1,
        'underline':  1,
        'font_size':  12,
})

# Add an alternate description string to the URL.
string = 'Grabación'
string = string.decode('utf-8')

# Add a "tool tip" to the URL.
tip = 'Haz clic aquí para acceder al fichero remoto.'
tip = tip.decode('utf-8')

# Write some hyperlinks
worksheet.write_url('A15',
'external://ordenador-remoto/Directorio/fichero.wav', red_format, string,
tip)

workbook.close()    




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.