Re: Post request and encoding

2020-11-03 Thread Hernán De Angelis
I see. Should be "encoding". Thanks. /H. On 2020-11-03 19:30, Dieter Maurer wrote: Hernán De Angelis wrote at 2020-11-2 10:06 +0100: ... My request has the form: header = {'Content-type':'application/xml', 'charset':'utf-8'} Not your problem (which you have already resolved) but: `charset` i

Re: asyncio question

2020-11-03 Thread Kyle Stanley
On Tue, Nov 3, 2020 at 3:27 AM Frank Millman wrote: > It works, and it does look neater. But I want to start some background > tasks before starting the server, and cancel them on Ctrl+C. > > Using the 'old' method, I can wrap 'loop.run_forever()' in a > try/except/finally, check for KeyboardInt

Re: Strange terminal behavior after quitting Tkinter application

2020-11-03 Thread Christian Gollwitzer
Am 03.11.20 um 23:34 schrieb Dennis Lee Bieber: Out of curiosity, does Python on Linux honor the .pyw extension? On Windows, .pyw indicates a Python program that implements a GUI and will NOT make use of console (stdin/stdout/stderr). On Linux, there is no such distinction. O

RE: Find word by given characters

2020-11-03 Thread Avi Gross via Python-list
Duncan, my comments below yours at end. ---YOURS--- The Counter approach only requires iterating over the letters once to construct the letters bag, then each word once to create the relevant word bag. After that it's (at worst) a couple of lookups and a comparison for each unique character in let

Re: Find word by given characters

2020-11-03 Thread duncan smith
On 03/11/2020 22:14, Avi Gross wrote: > I, too, have wondered what exactly the point was of the required > functionality for SCRABBLE but note you can extend a current word so > additional letters may be available in a game but only if they are an exact > fit to put before, after, or in middle of y

Re: Help

2020-11-03 Thread Grant Edwards
On 2020-11-04, Quentin Bock wrote: > So, I'm newer to Python and I'm messing around with math functions and > multiplication, etc. here is my line of code: > > def multiply(numbers): > total = 1 > for x in numbers: > total *= x > return total > print(mu

Re: Help

2020-11-03 Thread Skip Montanaro
> > When I run this, my answer is 8 but it should be 336 can some help ._. > Looks like you are returning from inside the loop. Skip > -- https://mail.python.org/mailman/listinfo/python-list

Help

2020-11-03 Thread Quentin Bock
So, I'm newer to Python and I'm messing around with math functions and multiplication, etc. here is my line of code: def multiply(numbers): total = 1 for x in numbers: total *= x return total print(multiply((8, 2, 3, -1, 7))) When I run this, my answer

Re: Find word by given characters

2020-11-03 Thread duncan smith
On 03/11/2020 23:35, Bischoop wrote: > On 2020-11-03, duncan smith wrote: >>> >> > from collections import Counter > letters = 'att' > letter_counts = Counter(letters) > word = 'tolerate' > wd_counts = Counter(word) > for char, cnt in letter_counts.items(): >> print (c

Re: Strange terminal behavior after quitting Tkinter application

2020-11-03 Thread MRAB
On 2020-11-03 20:11, David Burnette wrote: On Wednesday, April 18, 2007 at 12:33:24 AM UTC-7, Chris wrote: Hi, I'm puzzled by some strange behavior when my Python/Tkinter application quits (on linux): the terminal from which I started Python is messed up. If start up python, then import the code

Re: Find word by given characters

2020-11-03 Thread dn via Python-list
On 04/11/2020 12:27, Bischoop wrote: On 2020-11-03, Chris Angelico wrote: This seems strangely backwards for a Scrabble game. Normally you would have a set of available tiles, and you have to form a word using only those tiles, but it doesn't necessarily have to use them all. You seem to have

Re: Find word by given characters

2020-11-03 Thread Bischoop
On 2020-11-03, duncan smith wrote: >> > from collections import Counter letters = 'att' letter_counts = Counter(letters) word = 'tolerate' wd_counts = Counter(word) for char, cnt in letter_counts.items(): > print (cnt == wd_counts[char]) > > > True > Tru

Re: Find word by given characters

2020-11-03 Thread Bischoop
On 2020-11-03, Chris Angelico wrote: > > This seems strangely backwards for a Scrabble game. Normally you would > have a set of available tiles, and you have to form a word using only > those tiles, but it doesn't necessarily have to use them all. You seem > to have something where you must use al

RE: Find word by given characters

2020-11-03 Thread Avi Gross via Python-list
I, too, have wondered what exactly the point was of the required functionality for SCRABBLE but note you can extend a current word so additional letters may be available in a game but only if they are an exact fit to put before, after, or in middle of your word. But this seems to be a fairly simp

Re: Strange terminal behavior after quitting Tkinter application

2020-11-03 Thread David Burnette
On Wednesday, April 18, 2007 at 12:33:24 AM UTC-7, Chris wrote: > Hi, > I'm puzzled by some strange behavior when my Python/Tkinter > application quits (on linux): the terminal from which I started Python > is messed up. > If start up python, then import the code below, then start the program > wit

Re: Post request and encoding

2020-11-03 Thread Dieter Maurer
Hernán De Angelis wrote at 2020-11-2 10:06 +0100: > ... >My request has the form: > >header = {'Content-type':'application/xml', 'charset':'utf-8'} Not your problem (which you have already resolved) but: `charset` is not an individual header but a parameter for the `Content-Type` header. For `xml`

Fwd: [RELEASE] Python 3.10.0a2 available for testing

2020-11-03 Thread Pablo Galindo Salgado
The engines of the secret release manager machine have finished producing a new pre-release. Go get it here: https://www.python.org/downloads/release/python-3100a2/ *Major new features of the 3.10 series, compared to 3.9* Python 3.10 is still in development. This releasee, 3.10.0a2 is the secon

Re: Solaris 11 GUI framework

2020-11-03 Thread Grant Edwards
On 2020-11-02, Igor Korot wrote: > On Mon, Nov 2, 2020, 3:57 PM Jay Braun wrote: > >> Looking for a GUI framework supported on Solaris 11. > > Wxpython, pygtk, Java. I wouldn't start a new project with pygtk. It's obsolete (Python2 only) and is no longer supported/available on some platforms. It

Re: Find word by given characters

2020-11-03 Thread Chris Angelico
On Wed, Nov 4, 2020 at 1:11 AM Bischoop wrote: > Let me clarify what I want to do: > We all know Scrabble game. > there's a file with Dictionary containing word in each line, the idea is > to input some letters for example mentioned earlier: att, the script > supposed to find all words in which le

Re: Find word by given characters

2020-11-03 Thread duncan smith
On 03/11/2020 14:06, Bischoop wrote: > On 2020-11-03, dn wrote: >> >> >> The (full) specs are not clear. There's certainly room for >> misunderstanding. I'd be happier if I could 'see' a full spec or >> recognise a practical application, because then we'd be better able to >> discuss facts. Mea

Re: Best way to determine user's screensize?

2020-11-03 Thread Peter Pearson
On Sun, 1 Nov 2020 15:31:57 - (UTC), Grant Edwards wrote: > > I have no objection to saving the most recent window size and using > that on the next startup, but I hate applications that force the > _location_ of the window. I've configured my window manager to open > windows where I want them

Please help test astral char display in tkinter Text (especially *nix)

2020-11-03 Thread Terry Reedy
tcl/tk supports unicode chars in the BMP (Basic Multilingual Plane, utf-8 encoded with 1-3 bytes). The presence of chars in other plains ('astral', utf-8 encoded with 4 bytes, I believe) in a tkinter Text widget messages up *editing*, but they can sometimes be displayed with appropriate glyphs

Re: Find word by given characters

2020-11-03 Thread Ben Bacarisse
Bischoop writes: > Let me clarify what I want to do: > We all know Scrabble game. > there's a file with Dictionary containing word in each line, the idea is > to input some letters for example mentioned earlier: att, the script > supposed to find all words in which letters: 'a','t','t' occur and

Re: Find word by given characters

2020-11-03 Thread Bischoop
On 2020-11-03, dn wrote: > > > The (full) specs are not clear. There's certainly room for > misunderstanding. I'd be happier if I could 'see' a full spec or > recognise a practical application, because then we'd be better able to > discuss facts. Meantime, we try to help with what we have been

asyncio question

2020-11-03 Thread Frank Millman
Hi all My app runs an HTTP server using asyncio. A lot of the code dates back to Python 3.4, and I am trying to bring it up to date. There is one aspect I do not understand. The 'old' way looks like this - import asyncio def main(): loop = asyncio.get_event_loop() se