Sep-06-2018, 12:05 AM
(This post was last modified: Sep-06-2018, 12:05 AM by chaz_sliger.)
Octal Dump Of Text Read From File. (od -cbx filename)
. . . --> vvvvvvvvvvv
0001540 m i l y \n \n < P > \n 342 200 234 W h
155 151 154 171 040 012 012 074 120 076 012 342 200 234 127 150
696d 796c 0a20 3c0a 3e50 e20a 9c80 6857
0001560 y a r e y o u d o i n g
171 040 141 162 145 040 171 157 165 040 144 157 151 156 147 040
2079 7261 2065 6f79 2075 6f64 6e69 2067
. . .
Trying to use the following code to replace the non-printing sequence of 3 bytes with a single quote character ("):
It has no effect on the text as if it never finds a match.
. . . --> vvvvvvvvvvv
0001540 m i l y \n \n < P > \n 342 200 234 W h
155 151 154 171 040 012 012 074 120 076 012 342 200 234 127 150
696d 796c 0a20 3c0a 3e50 e20a 9c80 6857
0001560 y a r e y o u d o i n g
171 040 141 162 145 040 171 157 165 040 144 157 151 156 147 040
2079 7261 2065 6f79 2075 6f64 6e69 2067
. . .
Trying to use the following code to replace the non-printing sequence of 3 bytes with a single quote character ("):
1 |
text = re.sub(r '\342\200\234' , r '"' , text) |