Terry Reedy wrote:
> On 8/29/2020 12:18 PM, Chris Green wrote:
> > Well it sounds a silly question but I can't find the documentation for
> > read(). It's not a built-in function and it's not documented with
> > (for example) the file type object sys.stdin
On 8/29/2020 12:18 PM, Chris Green wrote:
Well it sounds a silly question but I can't find the documentation for
read(). It's not a built-in function and it's not documented with
(for example) the file type object sys.stdin.
sys.stdin is of no particular type, but must at lea
for
>Python read documentation)
>
>On 29/08/2020 17:18, Chris Green wrote:
>>Well it sounds a silly question but I can't find the documentation for
>>read(). It's not a built-in function and it's not documented with
>>(for example) the file
https://docs.python.org/3/tutorial/inputoutput.html#methods-of-file-objects
(It is in the top result returned by Google, searching for
Python read documentation)
On 29/08/2020 17:18, Chris Green wrote:
Well it sounds a silly question but I can't find the documentation for
read(). It
Well it sounds a silly question but I can't find the documentation for
read(). It's not a built-in function and it's not documented with
(for example) the file type object sys.stdin.
So where is it documented? :-)
--
Chris Green
·
--
https://mail.python.org/mailman/listinfo/python-list
On Wednesday, September 9, 2015 at 10:06:31 AM UTC+1, wxjm...@gmail.com wrote:
> Le mardi 8 septembre 2015 21:02:31 UTC+2, wxjm...@gmail.com a écrit :
> > Le mardi 8 septembre 2015 20:18:20 UTC+2, Irmen de Jong a écrit :
> > > On 8-9-2015 17:54, wxjmfa...@gmail.com wrote:
> > > > win7 / py433
> > >
On 8-9-2015 17:54, wxjmfa...@gmail.com wrote:
> win7 / py433
>
> How to downgrade from the latest pip (7.1.2) to
> the previous one?
> I'm sorry, I do not remember the numerous msgs
> I saw when updating. (Yesterday)
>
> (I'm serious)
>
> Now, what?
>
I think:
$ pip install --upgrade pip==7.0
On 9/6/2011 6:31 PM Joshua Miller said...
You sure it wasn't the invisible one? you know the one in the white
text that blends into the background?
Aah! So _that's_ significant whitespace!
:)
Emile
--
http://mail.python.org/mailman/listinfo/python-list
You sure it wasn't the invisible one? you know the one in the white
text that blends into the background?
On Tue, Sep 6, 2011 at 9:25 PM, MRAB wrote:
> On 07/09/2011 01:36, Ben Finney wrote:
>>
>> Zero Piraeus writes:
>>
>>> On 6 September 2011 12:17, Joseph Armbruster
>>> wrote:
I no
On 07/09/2011 01:36, Ben Finney wrote:
Zero Piraeus writes:
On 6 September 2011 12:17, Joseph Armbruster wrote:
I noticed that it says only 19 of 20 have been written down. Which
one was not written down?
The last one.
I always thought it was the first one. Or the 6.25th one, I forget.
Zero Piraeus writes:
> On 6 September 2011 12:17, Joseph Armbruster
> wrote:
> > I noticed that it says only 19 of 20 have been written down. Which
> > one was not written down?
>
> The last one.
I always thought it was the first one. Or the 6.25th one, I forget.
--
\“When in doubt
Joseph Armbruster wrote:
> I have used Python for some time and ran a windows build-bot for a bit.
> This morning, I told a fellow developer "There should be only one obvious
> way to do it." and then I proceeded to forward him to the Zen of Python
> and sent him a link to:
> http://www.python.or
:
On 6 September 2011 12:17, Joseph Armbruster wrote:
> I noticed that it says only 19 of 20 have been written down. Which one was
> not written down?
The last one.
-[]z.
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Sep 6, 2011 at 10:17 AM, Joseph Armbruster
wrote:
> I have used Python for some time and ran a windows build-bot for a bit.
> This morning, I told a fellow developer "There should be only one obvious
> way to do it." and then I proceeded to forward him to the Zen of Python and
> sent him
I have used Python for some time and ran a windows build-bot for a bit.
This morning, I told a fellow developer "There should be only one obvious
way to do it." and then I proceeded to forward him to the Zen of Python and
sent him a link to:
http://www.python.org/dev/peps/pep-0020/
I noticed that
On Feb 11, 1:57 am, Anthony Tolle wrote:
> On Feb 10, 3:42 pm,joy99 wrote:
>
> > Dear Group,
> > [snip]
> > I tried to change the location to D:\file and as I saw in Python Docs
> > the file reading option is now "r+" so I changed the statement to
> > file_open=open("D:\file","r+")
> > but it i
On Wed, 10 Feb 2010 21:23:08 +, Steven D'Aprano wrote:
> The solution to this is to remember that Windows accepts forward slashes
> as well as backslashes, and always use the forward slash. So try:
>
> open("D:/file")
>
> and see if that works.
The solution is not to hard-code pathnames i
On Wed, 10 Feb 2010 12:42:17 -0800, joy99 wrote:
> I tried to change the location to D:\file and as I saw in Python Docs
> the file reading option is now "r+" so I changed the statement to
>file_open=open("D:\file","r+")
> but it is still giving error.
You should copy and paste (do not re-ty
On Feb 10, 3:42 pm, joy99 wrote:
> Dear Group,
> [snip]
> I tried to change the location to D:\file and as I saw in Python Docs
> the file reading option is now "r+" so I changed the statement to
> file_open=open("D:\file","r+")
> but it is still giving error.
Only use "r+" if you need to also
Dear Group,
I was using Python with IDLE as GUI for quite some time. My Operating
System was Windows XP with Service Pack2.
Recently I changed the Operating System to Windows XP with Service
Pack3. I had to reinstall Python for which I downloaded
"python-2.6.4.msi"and loaded it in my D drive.
Her
On Fri, 21 Aug 2009 14:45:55 -0500, David C Ullrich
wrote:
>[...]
>
>Oops. Should have tested that a little more carefully
>before posting. No time to fix it right now, customer just
>got here. Let's just say we're looking for the primes
>between sqrt(n) and n...
from math import sqrt
def Prime
On Fri, 21 Aug 2009 14:40:30 -0500, David C Ullrich wrote:
> On Thu, 20 Aug 2009 16:51:00 -0700, Aahz wrote:
>
>> In article ,
>> Benjamin Kaplan wrote:
>>>On Thu, Aug 20, 2009 at 2:13 PM, David C Ullrich
>>>wrot= e:
I just noticed that
sequence[i:j:k]
>>>
>>>Well, I got some goo
On Thu, 20 Aug 2009 16:51:00 -0700, Aahz wrote:
> In article ,
> Benjamin Kaplan wrote:
>>On Thu, Aug 20, 2009 at 2:13 PM, David C Ullrich
>>wrot= e:
>>>
>>> I just noticed that
>>> sequence[i:j:k]
>>
>>Well, I got some good news and some bad news. According to the docs, it
>>existed in 1.4 but
On Thu, 20 Aug 2009 17:45:11 -0700, John Machin wrote:
> On Aug 21, 5:33 am, David C Ullrich wrote:
>
>> So I'm slow, fine. (There were several times when I was using 1.5.3 and
>> wished they were there - transposing matrices, etc.)
>
> 1.5.THREE ??
Not sure. 1.SOMETHING. Sorry about the CONFU
On Aug 21, 5:33 am, David C Ullrich wrote:
> So I'm slow, fine. (There were several times when I was using 1.5.3
> and wished they were there - transposing matrices, etc.)
1.5.THREE ??
--
http://mail.python.org/mailman/listinfo/python-list
In article ,
Benjamin Kaplan wrote:
>On Thu, Aug 20, 2009 at 2:13 PM, David C Ullrich wrot=
>e:
>>
>> I just noticed that
>> sequence[i:j:k]
>
>Well, I got some good news and some bad news. According to the docs,
>it existed in 1.4 but the built-in sequences didn't support it until
>2.3. It's not
On Thu, 20 Aug 2009 14:36:35 -0400, Benjamin Kaplan wrote:
> On Thu, Aug 20, 2009 at 2:13 PM, David C Ullrich
> wrote:
>> I just noticed that
>>
>> sequence[i:j:k]
>>
>> syntax in a post here. When did this happen?
>>
>> (I'm just curious whether it existed in 1.5.x or not. If so I'm stupid
>> -
On Thu, 20 Aug 2009 18:41:34 +, Duncan Booth wrote:
> David C Ullrich wrote:
>
>> I just noticed that
>>
>> sequence[i:j:k]
>>
>> syntax in a post here. When did this happen?
>>
>> (I'm just curious whether it existed in 1.5.x or not. If so I'm stupid
>> - otoh if it was introduced in 2
David C Ullrich wrote:
> I just noticed that
>
> sequence[i:j:k]
>
> syntax in a post here. When did this happen?
>
> (I'm just curious whether it existed in 1.5.x or not.
> If so I'm stupid - otoh if it was introduced in 2.x
> I'm just slow...)
>
>
Googling for 'python extended slice' ret
On Thu, Aug 20, 2009 at 2:13 PM, David C Ullrich wrote:
> I just noticed that
>
> sequence[i:j:k]
>
> syntax in a post here. When did this happen?
>
> (I'm just curious whether it existed in 1.5.x or not.
> If so I'm stupid - otoh if it was introduced in 2.x
> I'm just slow...)
>
Well, I got some
I just noticed that
sequence[i:j:k]
syntax in a post here. When did this happen?
(I'm just curious whether it existed in 1.5.x or not.
If so I'm stupid - otoh if it was introduced in 2.x
I'm just slow...)
--
http://mail.python.org/mailman/listinfo/python-list
Jeff Epler wrote:
> If you want to work with unicode, then write
> us = u"\N{COPYRIGHT SIGN} some text"
You can avoid almost all the wear and tear on your shift keys:
>>> u"\N{copyright sign}"
u'\xa9'
... you are stuck with \N for reasons that should be obvious :-)
Cheers,
John
--
htt
On 6/21/05, Jeff Epler <[EMAIL PROTECTED]> wrote:
> If you want to work with unicode, then write
> us = u"\N{COPYRIGHT SIGN} some text"
...and you can get unicode character names like that from unicodedata module:
>>> import unicodedata
>>> unicodedata.name(unichr(169))
'COPYRIGHT SIGN'
See a
If you want to work with unicode, then write
us = u"\N{COPYRIGHT SIGN} some text"
You can also write this as
us = unichr(169) + u" some text"
When you have a Unicode string, you can convert it to a particular
encoding stored in a byte string with
bs = us.encode("utf-8")
It's gen
Grig Gheorghiu wrote:
import codecs
print codecs.encode(c, 'utf-8')
>
> © some text
Or simply:
py> print c.encode('utf-8')
© some text
--
http://mail.python.org/mailman/listinfo/python-list
Catalin Constantin wrote:
> i have the following code:
>
> c=chr(169)+" some text"
>
> how can i utf8 encode the variable above ?
> something like in php utf8_encode($var);?!
>
> chr(169) is the © (c) sign !
>
> 10x for your help !
>
> p.s.: i tryed using codecs, etc but always get an error me
Salut, Catalin
You can first convert your c string to unicode, and in the process
specify an encoding that understands non-ASCII characters (if you don't
specify an encoding, it will try to use your default, which is most
likely ASCII, and you'll get the error you mentioned.). In the
following exa
i have the following code:
c=chr(169)+" some text"
how can i utf8 encode the variable above ?
something like in php utf8_encode($var);?!
chr(169) is the © (c) sign !
10x for your help !
p.s.: i tryed using codecs, etc but always get an error message
like: 'ascii' codec can't decode byte 0xa9 i
Jeff Epler wrote:
> The iterator for files is a little bit like this generator function:
>
Cool thanks for that, it looks like iter(f.readline, '') is the best
solution for the job.
Tom
--
http://mail.python.org/mailman/listinfo/python-list
Jeff Epler wrote:
On Sun, Apr 03, 2005 at 09:49:42PM -0600, Steven Bethard wrote:
Slick. Thanks!
does isatty() actually work on windows? I'm a tiny bit surprised!
Hmm... I was just talking about using iter(f.readline, ''), but it does
appear that isatty returns True for sys.stdin in the interac
On Sun, Apr 03, 2005 at 09:49:42PM -0600, Steven Bethard wrote:
> Slick. Thanks!
does isatty() actually work on windows? I'm a tiny bit surprised!
Jeff
pgp2TeZpqhdyV.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
Jeff Epler wrote:
The iterator for files is a little bit like this generator function:
def lines(f):
while 1:
chunk = f.readlines(sizehint)
for line in chunk: yield line
Inside file.readlines, the read from the tty will block until sizehint
bytes have been read o
The iterator for files is a little bit like this generator function:
def lines(f):
while 1:
chunk = f.readlines(sizehint)
for line in chunk: yield line
Inside file.readlines, the read from the tty will block until sizehint
bytes have been read or EOF is seen.
If
I'm not a Python expert by any means, but you're describing the
classic symptoms of buffering. There is a '-u' command line switch for
python to turn off buffering but that does not affect file iterators.
See http://www.hmug.org/man/1/python.html for instance.
Tom Eastman <[EMAIL PROTECTED]> wri
I'm not new to Python, but I didn't realise that sys.stdin could be called
as an iterator, very cool!
However, when I use the following idiom:
for line in sys.stdin:
doSomethingWith(line)
and then type stuff into the program interactively, nothing actually happens
until I hit CTRL-D.
"Fredrik Lundh" <[EMAIL PROTECTED]> writes:
> >> Well, but that's true as well for getchar() (at least in many cases of
> >> interactive input and line buffering), so in that respect I do think
> >> it's a fairly direct replacement, depending on how the OP was going to
> >> use getchar() in the ap
Jp Calderone wrote:
On Sun, 19 Dec 2004 23:15:40 GMT, Keith Dart <[EMAIL PROTECTED]> wrote:
Mike Meyer wrote:
The termios gives module gives you the tools to manipulate the tty
directly, without invoking stty. The tty module gives you an easier
interface to those routines. However, it's missing a s
On Sun, 19 Dec 2004 23:15:40 GMT, Keith Dart <[EMAIL PROTECTED]> wrote:
>Mike Meyer wrote:
> > The termios gives module gives you the tools to manipulate the tty
> > directly, without invoking stty. The tty module gives you an easier
> > interface to those routines. However, it's missing a setsane
Mike Meyer wrote:
Craig Ringer <[EMAIL PROTECTED]> writes:
On Sat, 2004-12-18 at 00:40, Amir Dekel wrote:
This must be the silliest question ever:
What about user input in Python? (like stdin)
Where can I find it? I can't find any references to it in the documentation.
Under UNIX, I generally eith
Craig Ringer <[EMAIL PROTECTED]> writes:
> On Sat, 2004-12-18 at 00:40, Amir Dekel wrote:
>> This must be the silliest question ever:
>>
>> What about user input in Python? (like stdin)
>> Where can I find it? I can't find any references to it in the documentation.
>
> Under UNIX, I generally eit
On Sat, 2004-12-18 at 00:40, Amir Dekel wrote:
> This must be the silliest question ever:
>
> What about user input in Python? (like stdin)
> Where can I find it? I can't find any references to it in the documentation.
Under UNIX, I generally either use curses, or just put the terminal into
raw m
>> Well, but that's true as well for getchar() (at least in many cases of
>> interactive input and line buffering), so in that respect I do think
>> it's a fairly direct replacement, depending on how the OP was going to
>> use getchar() in the application.
>
> The OP said "wait for a single charact
David Bolen <[EMAIL PROTECTED]> writes:
> Mike Meyer <[EMAIL PROTECTED]> writes:
>
>> Steven Bethard <[EMAIL PROTECTED]> writes:
>>
>> > Amir Dekel wrote:
>> >> What I need from the program is to wait for a single character
>> >> input, something like while(getchar()) in C. All those Python
>> >>
Mike Meyer <[EMAIL PROTECTED]> writes:
> Steven Bethard <[EMAIL PROTECTED]> writes:
>
> > Amir Dekel wrote:
> >> What I need from the program is to wait for a single character
> >> input, something like while(getchar()) in C. All those Python
> >> modules don't make much sence to me...
> >
> > sy
Mike Meyer wrote:
Hmm. That tells me he's probably on a Windows box, so my unix solution
wouldn't do him much good.
Yes, Windows...too bad
--
http://mail.python.org/mailman/listinfo/python-list
Steven Bethard <[EMAIL PROTECTED]> writes:
> Mike Meyer wrote:
>> That doesn't do what he wants, because it doesn't return until you hit
>> a newline.
> Of course if the intent is to have this work with terminal input, then
> yes, sys.stdin.read(1) is probably not going to do the right thing...
T
Mike Meyer wrote:
That doesn't do what he wants, because it doesn't return until you hit
a newline.
Are you sure that's not just an artifact of how your terminal buffers
data for sys.stdin?
$ cat temp.py
import sys
char = sys.stdin.read(1)
while char:
print char
char = sys.stdin.read(1)
$
Amir Dekel wrote:
What I need from the program is to wait for a single character input,
something like while(getchar()) in C. All those Python modules don't
make much sence to me...
Take a look at Alan Gauld's "Learning to Program"
(http://www.freenetpages.co.uk/hp/alan.gauld/)
in the section "Ev
Amir Dekel wrote:
Harlin Seritt wrote:
Simple, Simple, Simple:
Var = raw_input("Some prompting text here: ")
Frans Englich wrote:
>
> See sys.stdin
>
What I need from the program is to wait for a single character input,
something like while(getchar()) in C. All those Python modules don't
make
Steven Bethard <[EMAIL PROTECTED]> writes:
> Amir Dekel wrote:
>> What I need from the program is to wait for a single character
>> input, something like while(getchar()) in C. All those Python
>> modules don't make much sence to me...
>
> sys.stdin.read(1)
That doesn't do what he wants, because
Amir Dekel wrote:
What I need from the program is to wait for a single character input,
something like while(getchar()) in C.
Try the "msvcrt" module if you are on Windows.
If you are not, remember to specify your platform next time
you ask a question...
All those Python modules don't
make much
Amir Dekel wrote:
What I need from the program is to wait for a single character input,
something like while(getchar()) in C. All those Python modules don't
make much sence to me...
sys.stdin.read(1)
but if you're having trouble reading the module documentation, maybe you
could elaborate on what
Harlin Seritt wrote:
Simple, Simple, Simple:
Var = raw_input("Some prompting text here: ")
Frans Englich wrote:
>
> See sys.stdin
>
What I need from the program is to wait for a single character input,
something like while(getchar()) in C. All those Python modules don't
make much sence to me...
Amir Dekel wrote:
> This must be the silliest question ever:
>
> What about user input in Python? (like stdin)
> Where can I find it? I can't find any references to it in the
> documentation.
>
> Amir
Simple, Simple, Simple:
Var = raw_input("Some prompting text here: ")
--
Harlin Seritt
--
Title: RE: A completely silly question
[Amir Dekel]
#- What about user input in Python? (like stdin)
#- Where can I find it? I can't find any references to it in
#- the documentation.
sys.stdin
http://docs.python.org/lib/module-sys.html
. Fa
On Friday 17 December 2004 16:40, Amir Dekel wrote:
> This must be the silliest question ever:
>
> What about user input in Python? (like stdin)
> Where can I find it? I can't find any references to it in the
> documentation.
See sys.stdin
Cheers,
Frans
--
http://mail.python.or
This must be the silliest question ever:
What about user input in Python? (like stdin)
Where can I find it? I can't find any references to it in the documentation.
Amir
--
http://mail.python.org/mailman/listinfo/python-list
67 matches
Mail list logo