print with no newline

Paul Watson pwatson at redlinepy.com
Fri Sep 3 09:46:01 EDT 2004


I thought that using a comma at the end of a print statement would suppress
printing of a newline.  Am I misunderstanding this feature?  How can I use
print and not have a newline appended at the end?

C:\src\projects\test1>python -c "import sys;print sys.version, 'running on',
sys.platform"
2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] running on
win32

C:\src\projects\test1>python -c "print 'here'," >jjj

C:\src\projects\test1>od -c jjj
0000000   h   e   r   e  \r  \n
0000006


$ python -c "import sys;print sys.version, 'running on', sys.platform"
2.1 (#1, May 23 2003, 11:43:56) [C] running on aix4

$ cat eoltest.py
#!/usr/bin/env python
print 'here',

$ ./eoltest.py >jjj

$ od jjj
0000000  068 065 072 065 00a
           h   e   r   e  \n
0000005





More information about the Python-list mailing list