'Removing escapechars from my string, but when i try to break my csv apart it persists breaking the string in excel

so i have the following code

new_action = []
my_dict = {10:'breakchar'}
# Insira nessa dict o char poluidor

for i in df['Action']:
    try:
        z = i.translate(my_dict)
        new_action.append(z)
    except:
        new_action.append(0)

new_action = np.array(new_action)
df['NewAction'] = new_action.tolist()
df.columns

It has the responsibility of substituting every \n escape char into a 'breakline' string. But when i check if it worked in excel. It results in this

enter image description here

It substitutes the breakchar but excel keeps breaking the line after i open my csv archive, would appreciate a few inputs on the why?



Solution 1:[1]

new_action = []
my_dict = {10:'(new line)',13 : "(carriage ret)"}
# Insira nessa dict o char poluidor

for i in df['Action']:
    try:
        z = i.translate(my_dict)
        new_action.append(z)
    except:
        new_action.append(0)

new_action = np.array(new_action)
df['NewAction'] = new_action.tolist()
df.columns

Manage to find out the extra skipable character

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 INGl0R1AM0R1