Re: Silly question, where is read() documented?

2020-08-30 Thread Chris Green
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

Re: Silly question, where is read() documented?

2020-08-29 Thread Terry Reedy
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

Re: Silly question, where is read() documented?

2020-08-29 Thread Cameron Simpson
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

Re: Silly question, where is read() documented?

2020-08-29 Thread Ian Hobson
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&#x

Silly question, where is read() documented?

2020-08-29 Thread Chris Green
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

Re: Silly question about pip

2015-09-10 Thread breamoreboy
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 > > >

Re: Silly question about pip

2015-09-08 Thread Irmen de Jong
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

Re: PEP 20 - Silly Question?

2011-09-07 Thread Emile van Sebille
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

Re: PEP 20 - Silly Question?

2011-09-06 Thread Joshua Miller
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

Re: PEP 20 - Silly Question?

2011-09-06 Thread MRAB
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.

Re: PEP 20 - Silly Question?

2011-09-06 Thread Ben Finney
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

Re: PEP 20 - Silly Question?

2011-09-06 Thread Peter Otten
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

Re: PEP 20 - Silly Question?

2011-09-06 Thread Zero Piraeus
: 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

Re: PEP 20 - Silly Question?

2011-09-06 Thread Eric Snow
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

PEP 20 - Silly Question?

2011-09-06 Thread Joseph Armbruster
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

Re: A silly question on file opening

2010-02-12 Thread joy99
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

Re: A silly question on file opening

2010-02-10 Thread Nobody
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

Re: A silly question on file opening

2010-02-10 Thread Steven D'Aprano
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

Re: A silly question on file opening

2010-02-10 Thread Anthony Tolle
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

A silly question on file opening

2010-02-10 Thread joy99
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

Re: Silly question

2009-08-21 Thread David C . Ullrich
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

Re: Silly question

2009-08-21 Thread David C Ullrich
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

Re: Silly question

2009-08-21 Thread David C Ullrich
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

Re: Silly question

2009-08-21 Thread David C Ullrich
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

Re: Silly question

2009-08-20 Thread John Machin
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

Re: Silly question

2009-08-20 Thread Aahz
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

Re: Silly question

2009-08-20 Thread David C Ullrich
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 >> -

Re: Silly question

2009-08-20 Thread David C Ullrich
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

Re: Silly question

2009-08-20 Thread Duncan Booth
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

Re: Silly question

2009-08-20 Thread Benjamin Kaplan
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

Silly question

2009-08-20 Thread David C Ullrich
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

Re: utf8 silly question

2005-06-21 Thread John Machin
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

Re: utf8 silly question

2005-06-21 Thread Konstantin Veretennicov
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

Re: utf8 silly question

2005-06-21 Thread Jeff Epler
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

Re: utf8 silly question

2005-06-21 Thread Steven Bethard
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

Re: utf8 silly question

2005-06-21 Thread Qiangning Hong
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

Re: utf8 silly question

2005-06-21 Thread Grig Gheorghiu
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

utf8 silly question

2005-06-21 Thread Catalin Constantin
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

Re: Silly question re: 'for i in sys.stdin'?

2005-04-04 Thread Tom Eastman
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

Re: Silly question re: 'for i in sys.stdin'?

2005-04-04 Thread Steven Bethard
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

Re: Silly question re: 'for i in sys.stdin'?

2005-04-04 Thread Jeff Epler
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

Re: Silly question re: 'for i in sys.stdin'?

2005-04-03 Thread Steven Bethard
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

Re: Silly question re: 'for i in sys.stdin'?

2005-04-03 Thread Jeff Epler
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

Re: Silly question re: 'for i in sys.stdin'?

2005-04-03 Thread David Trudgett
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

Silly question re: 'for i in sys.stdin'?

2005-04-03 Thread Tom Eastman
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.

Re: A completely silly question

2004-12-20 Thread David Bolen
"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

Re: A completely silly question

2004-12-19 Thread Keith Dart
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

Re: A completely silly question

2004-12-19 Thread Jp Calderone
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

Re: A completely silly question

2004-12-19 Thread Keith Dart
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

Re: A completely silly question

2004-12-19 Thread Mike Meyer
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

Re: A completely silly question

2004-12-18 Thread Craig Ringer
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

Re: A completely silly question

2004-12-17 Thread Fredrik Lundh
>> 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

Re: A completely silly question

2004-12-17 Thread Mike Meyer
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 >> >>

Re: A completely silly question

2004-12-17 Thread David Bolen
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

Re: A completely silly question

2004-12-17 Thread Amir Dekel
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

Re: A completely silly question

2004-12-17 Thread Mike Meyer
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

Re: A completely silly question

2004-12-17 Thread Steven Bethard
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) $

Re: A completely silly question

2004-12-17 Thread marco
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

Re: A completely silly question

2004-12-17 Thread wes weston
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

Re: A completely silly question

2004-12-17 Thread Mike Meyer
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

Re: A completely silly question

2004-12-17 Thread Peter Hansen
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

Re: A completely silly question

2004-12-17 Thread Steven Bethard
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

Re: A completely silly question

2004-12-17 Thread Amir Dekel
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...

Re: A completely silly question

2004-12-17 Thread Harlin Seritt
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 --

RE: A completely silly question

2004-12-17 Thread Batista, Facundo
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

Re: A completely silly question

2004-12-17 Thread Frans Englich
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

A completely silly question

2004-12-17 Thread Amir Dekel
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