On Mon, Nov 25, 2013 at 1:31 AM, Steven D'Aprano
wrote:
> I don't think the REPL handles return values inside loops any different
> from how it handles them outside loops. The difference is that file.write
> methods used to return None in Python 2, in Python 3 they return the
> number of bytes wri
On Sun, 24 Nov 2013 01:16:18 +1100, Chris Angelico wrote:
> On Sun, Nov 24, 2013 at 12:26 AM, Frank Millman
> wrote:
>> for i in range(10):
>> sys.stdout.write('.')
>> sys.stdout.flush()
>> time.sleep(1)
>> sys.stdout.write('\n')
>>
>> I tried it under Python3, and found that it differs in
On Sun, Nov 24, 2013 at 12:26 AM, Frank Millman wrote:
> for i in range(10):
> sys.stdout.write('.')
> sys.stdout.flush()
> time.sleep(1)
> sys.stdout.write('\n')
>
> I tried it under Python3, and found that it differs in two ways -
>
> 1. Each 'write' is terminated by a newline
> 2. Each 'w
On Jan 11, 2010, at 1:47 PM Nobody wrote:
On Mon, 11 Jan 2010 10:09:36 +0100, Martin v. Loewis wrote:
In Python 3.1 is there any difference in the buffering behavior of
the
initial sys.stdout and sys.stderr streams?
No.
Were they different at some earlier point in Python's evolution?
On Mon, 11 Jan 2010 10:09:36 +0100, Martin v. Loewis wrote:
>> In Python 3.1 is there any difference in the buffering behavior of the
>> initial sys.stdout and sys.stderr streams?
>
> No.
>
>> Were they different at some earlier point in Python's evolution?
>
> That depends on the operating sys
> In Python 3.1 is there any difference in the buffering behavior of the
> initial sys.stdout and sys.stderr streams?
No.
> Were they different at some earlier point in Python's evolution?
That depends on the operating system. These used to be whatever the
C library set up as stdout and stderr.
On Mon, 23 Nov 2009 23:08:25 +0100, Diez B. Roggisch wrote:
> Try printing
>
>stdout.write('\r-->%d')
^M-->0^M-->1^M-->2^M-->3... ;)
But it's probably good enough for the OP's purposes.
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 23, 8:54 pm, Dave Angel wrote:
> Jankins wrote:
> > On Nov 23, 4:08 pm, "Diez B. Roggisch" wrote:
>
> >> Jankins schrieb:
>
> >>> I am trying to use sys.stdout to print out "process-bar" like:
> >>> -->1%
>
> >>> Here is my program ‘test.py’:
>
> >>> from sys import stdout
> >>> for v in r
On Nov 23, 8:32 pm, Cousin Stanley wrote:
> >>
> >> You misunderstand what "flush" means. It is not about
> >> clearing the screen, or the line.
>
> >> Try printing
>
> >> stdout.write('\r-->%d')
>
> >> Diez
>
> > But there is still a problem. When you use control character '\r',
> > you a
Jankins wrote:
On Nov 23, 4:08 pm, "Diez B. Roggisch" wrote:
Jankins schrieb:
I am trying to use sys.stdout to print out "process-bar" like:
-->1%
Here is my program ‘test.py’:
from sys import stdout
for v in range(10):
stdout.write('-->%d' % v)
stdout.flu
>>
>> You misunderstand what "flush" means. It is not about
>> clearing the screen, or the line.
>>
>> Try printing
>>
>> stdout.write('\r-->%d')
>>
>> Diez
>
>
> But there is still a problem. When you use control character '\r',
> you actually move to the head of the current buffer line
On Nov 23, 4:08 pm, "Diez B. Roggisch" wrote:
> Jankins schrieb:
>
>
>
>
>
> > I am trying to use sys.stdout to print out "process-bar" like:
> > -->1%
>
> > Here is my program ‘test.py’:
>
> > from sys import stdout
> > for v in range(10):
> > stdout.write('-->%d' % v)
> > stdout.flush()
On Nov 23, 4:08 pm, "Diez B. Roggisch" wrote:
> Jankins schrieb:
>
>
>
>
>
> > I am trying to use sys.stdout to print out "process-bar" like:
> > -->1%
>
> > Here is my program ‘test.py’:
>
> > from sys import stdout
> > for v in range(10):
> > stdout.write('-->%d' % v)
> > stdout.flush()
Jankins schrieb:
I am trying to use sys.stdout to print out "process-bar" like:
-->1%
Here is my program ‘test.py’:
from sys import stdout
for v in range(10):
stdout.write('-->%d' % v)
stdout.flush()
else:
stdout.write('done!')
#end for
Then, I use 'python -u test.py' to run this s
> Are you sure that Python wasn't just printing out "\n" because you'd
> asked it to show you the repr() of a string containing newlines?
Yes, I am sure. Because I dumped the ord() values to check them.
But again, I'm stumped on how complicated I have made this.
I should not try to code anymore at
Thierry wrote:
> Thank you to both of you (Marc and Tino).
>
> I feel a bit stupid right now, because as both of you said, encoding
> my source string to utf-8 do not produce an exception when I pass it
> to urllib.quote() and is what it should be.
> I was certain that this created an error sooner
Thank you to both of you (Marc and Tino).
I feel a bit stupid right now, because as both of you said, encoding
my source string to utf-8 do not produce an exception when I pass it
to urllib.quote() and is what it should be.
I was certain that this created an error sooner, and id not tried it
again
On Tue, 11 Nov 2008 12:18:26 -0800, Thierry wrote:
> I have realized an wxPython simple application, that takes the input of
> a user, send it to a web service, and get back translations in several
> languages.
> The service itself is fully UTF-8.
>
> The "source" string is first encoded to "lati
Thierry wrote:
Hello fellow pythonists,
I'm a relatively new python developer, and I try to adjust my
understanding about "how things works" to python, but I have hit a
block, that I cannot understand.
I needed to output unicode datas back from a web service, and could
not get back unicode/multi
> import sys
> class ThreadedOut:
> def __init__( self, old ):
> self._old= old
> def write( self, s ):
> self._old.write( s )
> sys.stdout= ThreadedOut( sys.stdout )
>
> Python 3.0a2 WinXP, on the console. 'a' is undeclared but error
> message isn't
Jorgen Grahn a écrit :
> On 9 Sep 2005 03:40:58 -0700, Sébastien Boisgérault <[EMAIL PROTECTED]> wrote:
> >
> > Fredrik Lundh wrote:
> >> Sébastien Boisgérault wrote:
> >>
> >> > Thanks for your answer. The execution of your example leads to a
> >> > 'aaa' display during 2 secs, before it is era
On 9 Sep 2005 03:40:58 -0700, Sébastien Boisgérault <[EMAIL PROTECTED]> wrote:
>
> Fredrik Lundh wrote:
>> Sébastien Boisgérault wrote:
>>
>> > Thanks for your answer. The execution of your example leads to a
>> > 'aaa' display during 2 secs, before it is erased by the prompt.
>> >
>> > This behav
Fredrik Lundh a écrit :
> > what "python shell" are you using, and what platform are you running
> > it on? here's what I get on a standard Unix console:
> >
> import sys
> sys.stdout.write("")
> > >>> sys.stdout.write("\n")
> >
> sys.stdout.write("\n")
>
Fredrik Lundh wrote:
> Sébastien Boisgérault wrote:
>
> > Thanks for your answer. The execution of your example leads to a
> > 'aaa' display during 2 secs, before it is erased by the prompt.
> >
> > This behavior is standard ? The standard output is not supposed
> > to *concatenate* the 'aaa' and
> what "python shell" are you using, and what platform are you running
> it on? here's what I get on a standard Unix console:
>
import sys
sys.stdout.write("")
> >>> sys.stdout.write("\n")
>
sys.stdout.write("\n")
>
> >>>
btw, what does
>>> sy
Robert Kern wrote:
> Sébastien Boisgérault wrote:
> > Tiissa,
> >
> > Thanks for your answer. The execution of your example leads to a
> > 'aaa' display during 2 secs, before it is erased by the prompt.
> >
> > This behavior is standard ? The standard output is not supposed
> > to *concatenate* t
Sébastien Boisgérault wrote:
> Thanks for your answer. The execution of your example leads to a
> 'aaa' display during 2 secs, before it is erased by the prompt.
>
> This behavior is standard ? The standard output is not supposed
> to *concatenate* the 'aaa' and the '>>>' ?
what "python shell" a
Sébastien Boisgérault wrote:
> Tiissa,
>
> Thanks for your answer. The execution of your example leads to a
> 'aaa' display during 2 secs, before it is erased by the prompt.
>
> This behavior is standard ? The standard output is not supposed
> to *concatenate* the 'aaa' and the '>>>' ?
FWIW:
P
Tiissa,
Thanks for your answer. The execution of your example leads to a
'aaa' display during 2 secs, before it is erased by the prompt.
This behavior is standard ? The standard output is not supposed
to *concatenate* the 'aaa' and the '>>>' ?
SB
--
http://mail.python.org/mailman/listinfo/pyt
Sébastien Boisgérault a écrit :
> The sys.stdout stream behaves strangely in my
> Python2.4 shell:
>
> >>> import sys
> >>> sys.stdout.write("")
> >>> sys.stdout.write("\n")
>
> >>> sys.stdout.write("\n")
>
> >>> sys.stdout.flush()
> [...not
chris patton wrote:
> I tried adding the comma at the end
> print 'hello',
> It still added that extra character.
http://mail.python.org/pipermail/python-list/2003-September/184181.html
Peter
--
In diesen Kreisen kreiselt sich der Kreisler
--
http://mail.python.org/mailman/listinfo/python-li
Save your script and run that from a commandline or import it with your
python shell.
['this is a string.', ' ', 'This is another string.']
You are seeing a side effect of the interactive shell.
['this is a string.', '\n', 'This is another string.','\n']
It would be hard to get to the next prompt
I tried adding the comma at the end
print 'hello',
It still added that extra character.
--
http://mail.python.org/mailman/listinfo/python-list
Print is the culprit here. Note item 2.
>>> help('print')
6.6 The print statement
print_stmt::="print" ( [expression[1] ("," expression[2])*
[","]]
| ">>" expression[3] [("," expression[4])+ [","]] )
Download entire grammar as text.[5]
print e
chris patton wrote:
import sys
class stuff:
>
> ... things = []
> ... def write(self, string):
> ... self.things.append(string)
> ...
>
def_stdout = sys.stdout
sys.stdout = stuff()
print 'this is a string.'
print 'This is another string.'
sys.
35 matches
Mail list logo