This feels like it should be an easy one, but I'm having trouble cleaning out the newline character in content pasted from Microsoft Word. Not a full line-break, but the CTRL ENTER character that shows up as a return arrow in Word. I've tried chr(10)
, chr(13)
, \u000D
, \u000A
and a few others, but I can't match it in a string.replace(). Should I be looking for a different character or do I need to use something other than the string.replace
method?
views:
657answers:
2
+4
A:
Run this:
print repr(mystringobject)
That will give a hint of which character you want to remove.
If still no clue, paste the result of the command above in the question, and I'll edit my answer.
nosklo
2009-05-21 15:24:51
Thanks to both you and Chris. It was \x0b
Tom
2009-05-21 15:32:35
+1
A:
you can get the ASCII value of the character like this:
for c in 'string':
print ord(c), hex(ord(c))
once you know the code, it should be easy to kill the offender.
Chris Lawlor
2009-05-21 15:31:36