Deleuze,
I always find it easier to marshal the dynamic array into a Python list. Then manipulating it becomes a lot easier.
i.e. simple example, minus actually writing it to a file, but you should get the idea
python> import u2py
python> file = u2py.File("STATES")
python> csv_string = ','.join(file.read("CA").to_list())
python> print(csv_string)
California,West,Pacific
And like any thing in Python, there are many ways to do most things.
------------------------------
Mike Rajkowski
MultiValue Product Evangelist
Rocket Internal - All Brands
US
------------------------------
Original Message:
Sent: 04-04-2024 18:23
From: deleuze jean
Subject: U2PY and universe Encoding Decoding with Python
Hello all,
I made a python script to read multivalue data in universe account and write in a file as CSV for example.
So, for decoding I use cp850.
Until that everithing working.
When it's time to write I receive this error:
error cp1252:
UnicodeEncodeError: 'charmap' codec can't encode character '\u2591' in position 88: character maps to «undefined»
So decode is good with cp850, ok with that ?
Problem is encoding ?
Maybe I can force encoding in utf-8 but I don't know how to do that ?
Do you have an universe idea ? :-)
Thank you !
Jean
------------------------------
deleuze jean
Rocket Forum Shared Account
------------------------------