This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年06月06日 14:47 by jjanis, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg162413 - (view) | Author: Jānis (jjanis) | Date: 2012年06月06日 14:47 | |
test = "Hi there :)"
print len(test), test // Prints "11 Hi there :)"
test = test.replace(" ", "\x00")
print len(test), test // Prints "11
On Windows '\x00' is same as ' ', but on linux string is terminated at first occurance of '\x00'. Results on problems with pySerial and binary data, so I can't replace '\x00' with ' '.
|
|||
| msg162414 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年06月06日 15:11 | |
Windows makes \x00 a space? How odd.
This is the result for me on linux:
Python 2.7.3+ (2.7:1f5d2642929a, May 25 2012, 12:47:34)
[GCC 4.5.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> test = "Hi there :)"
>>> print len(test), test
11 Hi there :)
>>> test = test.replace(" ", "\x00")
>>> print len(test), test
11 Hithere:)
Your comment on the last line of your example seems to have been truncated, so I'm not sure what you really saw.
|
|||
| msg162538 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2012年06月08日 17:18 | |
Jānis, please present examples as proper python -- indentation and comment char -- so others can copy/paste to run without editing. In Idle (tkinter -- tk), '0円' is displayed as a wider space than ' '. The console is fixed pitch, so it cannot do that. I suspect that the response of a window to 0円 is window system dependent and probably out of our control. If so, this issue should be closed. |
|||
| msg162902 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2012年06月15日 14:17 | |
Jānis: > Prints "11 This is not what I get on Linux: I see "11 Hithere:)" because the console chooses to not print the \x00. The character is present in the output stream though. Did you really got a truncated output? How did you run the above script? |
|||
| msg185416 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2013年03月28日 10:08 | |
Closing due to lack of response. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:31 | admin | set | github: 59224 |
| 2013年03月28日 10:08:29 | georg.brandl | set | status: pending -> closed nosy: + georg.brandl messages: + msg185416 resolution: works for me |
| 2013年01月15日 16:57:06 | serhiy.storchaka | set | status: open -> pending |
| 2012年06月15日 14:17:21 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc messages: + msg162902 |
| 2012年06月15日 08:08:48 | ezio.melotti | set | nosy:
+ ezio.melotti |
| 2012年06月08日 17:18:00 | terry.reedy | set | nosy:
+ terry.reedy messages: + msg162538 title: Sting termination on Linux -> String termination on Linux |
| 2012年06月06日 15:11:44 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg162414 |
| 2012年06月06日 14:47:44 | jjanis | create | |