Re: Fwd: Issue in installing Python (Windows 10)

2020-08-28 Thread 2QdxY4RzWzUUiLuE
On 2020-08-28 at 18:38:03 -0500, Debasis Chatterjee wrote: > By the way, is there a site where I can login to see such mails and > also manage mail notification options? Better than that, you can have the emails themselves delivered directly to your inbox: https://mail.python.org/mailman/listin

Fwd: Issue in installing Python (Windows 10)

2020-08-28 Thread Debasis Chatterjee
-- Forwarded message - From: Debasis Chatterjee Date: Fri, Aug 28, 2020 at 3:41 AM Subject: Re: Issue in installing Python (Windows 10) To: Terry Reedy Hi Terry, OK. I think the issue is now solved. I used "pip uninstall" and then "pip install". With that I can run Python pro

Re: Didn't understand the output of the following Python 3 code with reduce function?

2020-08-28 Thread Ben Bacarisse
Shivlal Sharma writes: > I have seen this code on one of competative programming site but I > didn't get it, Why output is 9? > > from functools import * > > def ADDS(a,b): > return a+1 > nums = [1, 2, 3, 4, 5, 6, 7, 8, 9] > add = reduce(ADDS, nums) > print(add) > > output: 9 Hint: reduce(f

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Cameron Simpson
On 28Aug2020 12:26, Chris Green wrote: >Cameron Simpson wrote: >> POP3 is presumably handing you bytes containing a message. If the >> Python >> email.BytesParser doesn't handle it, stash the raw bytes _elsewhere_ in >> a distinct file in some directory. >> >> with open('evil_msg_bytes', 'wb

RE: How do I place a preset into the text box?

2020-08-28 Thread Steve
Works like a charm, special thanks. Steve = Footnote: He called his wife to see if he should pick up Fish and Chips on the way home. She hung up on him. She is still fuming over letting him name the kids. -Original Message- From: Pyth

RE: How do I place a preset into the text box?

2020-08-28 Thread Steve
Yes, the form/window now closes properly. Removal of sys.exit() and inserting window.destroy() cleared up the exiting problem. Thanks. I saw several variations on that but I guess I just never twerked it enough. Footnote: "What rhymes with orange?" "No it doesn't.." From: Colin M

Re: Video file to subtitles file

2020-08-28 Thread Chris Angelico
On Sat, Aug 29, 2020 at 3:24 AM Barry wrote: > > > > > On 28 Aug 2020, at 17:37, Muskan Sanghai wrote: > > > > On Friday, August 28, 2020 at 12:27:25 AM UTC+5:30, Barry Scott wrote: > On 27 Aug 2020, at 18:00, Muskan Sanghai wrote: > >>> > >>> I would be really thankful if someone can sugg

Re: Video file to subtitles file

2020-08-28 Thread Barry
> On 28 Aug 2020, at 17:37, Muskan Sanghai wrote: > > On Friday, August 28, 2020 at 12:27:25 AM UTC+5:30, Barry Scott wrote: On 27 Aug 2020, at 18:00, Muskan Sanghai wrote: >>> >>> I would be really thankful if someone can suggest me how can I generate >>> subtitles file (srt format)

Re: Video file to subtitles file

2020-08-28 Thread Muskan Sanghai
On Friday, August 28, 2020 at 12:27:25 AM UTC+5:30, Barry Scott wrote: > > On 27 Aug 2020, at 18:00, Muskan Sanghai wrote: > > > > I would be really thankful if someone can suggest me how can I generate > > subtitles file (srt format) from a video or audio without using Google > > cloud and AW

Re: Didn't understand the output of the following Python 3 code with reduce function?

2020-08-28 Thread Peter Otten
Shivlal Sharma wrote: > I have seen this code on one of competative programming site but I didn't > get it, Why output is 9? > > from functools import * > > def ADDS(a,b): > return a+1 > nums = [1, 2, 3, 4, 5, 6, 7, 8, 9] > add = reduce(ADDS, nums) > print(add) > > output: 9 Rewrite the AD

RE: Didn't understand the output of the following Python 3 code with reduce function?

2020-08-28 Thread David Raymond
All the numbers in the nums list don't matter and aren't used. Only the first number, and how many there are. https://docs.python.org/3.8/library/functools.html#functools.reduce Basically it's doing ADDS(1, 2) which returns 2 that 2 gets fed back into ADDS(2, 3) which returns 3 that 3 gets fed ba

Didn't understand the output of the following Python 3 code with reduce function?

2020-08-28 Thread Shivlal Sharma
I have seen this code on one of competative programming site but I didn't get it, Why output is 9? from functools import * def ADDS(a,b): return a+1 nums = [1, 2, 3, 4, 5, 6, 7, 8, 9] add = reduce(ADDS, nums) print(add) output: 9 -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 8:44 AM, Chris Green wrote: > Stefan Ram wrote: >> Chris Green writes: >>> Therein lies the problem, the incoming byte stream *isn't* ASCII, it's >>> an E-Mail message which may, for example, have UTF-8 or other encoded >>> characters in it. Hopefully it will have an encoding given in

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Angelico
On Fri, Aug 28, 2020 at 11:24 PM Chris Green wrote: > > Chris Angelico wrote: > > > > Also, if you're parsing an email message, you can and should be doing > > so with respect to the encoding(s) stipulated in the headers, after > > which you will have valid Unicode text. > > > But not all E-Mail

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread D'Arcy Cain
On 2020-08-28 08:30, Richard Damon wrote: > This might be one of the cases where Python 2's lack handling of string > vs bytes was an advantage. For English speaking Americans. > Python2 handled that sort of case quite easily. Python 3 on the other > hand, will have issue converting the byte mess

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Chris Angelico wrote: > > Also, if you're parsing an email message, you can and should be doing > so with respect to the encoding(s) stipulated in the headers, after > which you will have valid Unicode text. > But not all E-Mail messages are 'well behaved', the above works fine if the headers sp

Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Karsten Hilbert
> I want to transport the message into my mbox and Python 3 won't do it > without knowing how it's encoded whereas Python 2 just stuffed it in > there 'as is'. > > I want Python 3's mailbox class to juyst put what I tell it (even if > mis-formatted or mis-encoded) into the mbox. I guess using the

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 8:39 AM, Chris Green wrote: > Richard Damon wrote: >> On 8/28/20 7:50 AM, Karsten Hilbert wrote: > No interpreation requires, since parsing failed. Then you can start > dealing with these exceptions. _Do not_ write unparsable messages into > an mbox! > Maybe I shoul

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Angelico
On Fri, Aug 28, 2020 at 10:51 PM Chris Green wrote: > > > One possible solution in Python3 is to decode the byte string using an > > encoding that allows all 256 byte values, so it won't raise any encoding > > errors, just give your possibly non-sense characters for non-ASCII text. > > > But this

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Stefan Ram wrote: > Chris Green writes: > >Therein lies the problem, the incoming byte stream *isn't* ASCII, it's > >an E-Mail message which may, for example, have UTF-8 or other encoded > >characters in it. Hopefully it will have an encoding given in the > >header but that's only if the sender

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Richard Damon wrote: > On 8/28/20 7:50 AM, Karsten Hilbert wrote: > >>> No interpreation requires, since parsing failed. Then you can start > >>> dealing with these exceptions. _Do not_ write unparsable messages into > >>> an mbox! > >>> > >> Maybe I shouldn't but Python 2 has been managing to do

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Angelico
On Fri, Aug 28, 2020 at 10:32 PM Richard Damon wrote: > > This might be one of the cases where Python 2's lack handling of string > vs bytes was an advantage. > > If he was just scanning the message for specific ASCII strings, then not > getting the full message decoded write is unlikely to have b

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 7:50 AM, Karsten Hilbert wrote: >>> No interpreation requires, since parsing failed. Then you can start >>> dealing with these exceptions. _Do not_ write unparsable messages into >>> an mbox! >>> >> Maybe I shouldn't but Python 2 has been managing to do so for several >> years without an

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 7:50 AM, Karsten Hilbert wrote: >>> No interpreation requires, since parsing failed. Then you can start >>> dealing with these exceptions. _Do not_ write unparsable messages into >>> an mbox! >>> >> Maybe I shouldn't but Python 2 has been managing to do so for several >> years without an

Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Karsten Hilbert
> > No interpreation requires, since parsing failed. Then you can start > > dealing with these exceptions. _Do not_ write unparsable messages into > > an mbox! > > > Maybe I shouldn't but Python 2 has been managing to do so for several > years without any issues. I am inclined to congratulate you

Re: How do I place a preset into the text box?

2020-08-28 Thread Cousin Stanley
Steve wrote: > The following program compiles but does not quite do what I would like it to > do. Line 19 is the preset information but I do not seem to be able to get it > into the form by code. My purpose is to let the user make changes without > having to re-enter the entire code. > You

Re: How do I place a preset into the text box?

2020-08-28 Thread Colin McPhail via Python-list
Hi Steve, > On 28 Aug 2020, at 11:03, Steve wrote: > > > The following program compiles but does not quite do what I would like it to > do. Line 19 is the preset information but I do not seem to be able to get it > into the form by code. My purpose is to let the user make changes without > hav

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Cameron Simpson wrote: > On 28Aug2020 08:56, Chris Green wrote: > >Stefan Ram wrote: > >> Chris Angelico writes: > >> >But this is a really good job for a list comprehension: > >> >sss = [str(word) for word in bbb] > >> > >> Are you all sure that "str" is really what you all want? > >> > >Not

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Cameron Simpson
On 28Aug2020 08:56, Chris Green wrote: >Stefan Ram wrote: >> Chris Angelico writes: >> >But this is a really good job for a list comprehension: >> >sss = [str(word) for word in bbb] >> >> Are you all sure that "str" is really what you all want? >> >Not absolutely, you no doubt have been follow

How do I place a preset into the text box?

2020-08-28 Thread Steve
The following program compiles but does not quite do what I would like it to do. Line 19 is the preset information but I do not seem to be able to get it into the form by code. My purpose is to let the user make changes without having to re-enter the entire code. Suggestions welcome. Steve #==

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Cameron Simpson wrote: > On 27Aug2020 23:54, Marco Sulla wrote: > >Are you sure you want `str()`? > > > str(b'aaa') > >"b'aaa'" > > > >Probably you want: > > > >map(lambda x: x.decode(), bbb) > > _And_ you need to know the encoding of the text in the bytes. The above > _assumes_ UTF-8 beca

Re: How do I do this in Python 3 (string.join())?

2020-08-28 Thread Chris Green
Cameron Simpson wrote: [snip] > > >The POP3 processing is solely to collect E-Mail that ends up in the > >'catchall' mailbox on my hosting provider. It empties the POP3 > >catchall mailbox, checks for anything that *might* be for me or other > >family members then just deletes the rest. > > Ver

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Chris Angelico wrote: > On Fri, Aug 28, 2020 at 6:36 AM Chris Green wrote: > > > > This sounds quite an easy thing to do but I can't find how to do it > > elegantly. > > > > I have a list of bytes class objects (i.e. a list containing sequences > > of bytes, which are basically text) and I want t

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Stefan Ram wrote: > Chris Angelico writes: > >But this is a really good job for a list comprehension: > >sss = [str(word) for word in bbb] > > Are you all sure that "str" is really what you all want? > Not absolutely, you no doubt have been following other threads related to this one. :-)

Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Karsten Hilbert
> >Are you sure you want `str()`? > > > str(b'aaa') > >"b'aaa'" > > > >Probably you want: > > > >map(lambda x: x.decode(), bbb) > > _And_ you need to know the encoding of the text in the bytes. The above > _assumes_ UTF-8 because that is the default for bytes.decode, and if > that is _not_ wha