Re: Tkinter docs?

2023-05-23 Thread Chris Angelico
On Wed, 24 May 2023 at 13:11, Rob Cliffe via Python-list wrote: > > I have recently started converting a large project to tkinter, starting > with zero knowledge of tkinter. (You are free to think: BAD IDEA. 😁) > I am well aware that adopting a new tool always involves a learning > curve, and tha

Re: OT: Addition of a .= operator

2023-05-23 Thread dn via Python-list
On 24/05/2023 12.27, Chris Angelico wrote: On Wed, 24 May 2023 at 10:12, dn via Python-list wrote: However, (continuing @Peter's theme) such confuses things when something goes wrong - was the error in the input() or in the float()? - particularly for 'beginners' - and yes, we can expand the ab

Re: Tkinter docs?

2023-05-23 Thread aapost
On 5/23/23 21:18, Rob Cliffe wrote: Comments, anyone? Better yet (holds breath ...) can anyone point me towards some decent tkinter documentation? The variables are slightly more integrated when using tcl/tk directly, python has to have the object so you can track/use them easier. And the v

RE: where is requests

2023-05-23 Thread Mike Dewhirst
Try pip install requests--(Unsigned mail from my phone) Original message From: Rich Osborne Date: 24/5/23 11:49 (GMT+10:00) To: python-list@python.org Subject: where is requests I have install Python 3.11.3 but my import requests does not work. I found documentation that refe

Re: Tkinter docs?

2023-05-23 Thread Grant Edwards
On 2023-05-24, Rob Cliffe via Python-list wrote: > I have recently started converting a large project to tkinter, starting > with zero knowledge of tkinter.  (You are free to think: BAD IDEA. 😁) Well, you could be translating them to Tcl/Tk -- so on the scale of bad ideas, your's barely register

Tkinter docs?

2023-05-23 Thread Rob Cliffe via Python-list
I have recently started converting a large project to tkinter, starting with zero knowledge of tkinter.  (You are free to think: BAD IDEA. 😁) I am well aware that adopting a new tool always involves a learning curve, and that one is prone to think that things are more difficult than they are/sho

Re: where is requests

2023-05-23 Thread MRAB
On 2023-05-24 01:14, Rich Osborne wrote: I have install Python 3.11.3 but my import requests does not work. I found documentation that refers to C:\python35 but I am on 3.11.3. Where do I find requests? It's not part of the standard library. You can import it using pip. If you're on Windows,

where is requests

2023-05-23 Thread Rich Osborne
I have install Python 3.11.3 but my import requests does not work. I found documentation that refers to C:\python35 but I am on 3.11.3. Where do I find requests? Sent from Mail for Windows -- https://mail.python.org/mailman/listinfo/python-list

Re: OT: Addition of a .= operator

2023-05-23 Thread Chris Angelico
On Wed, 24 May 2023 at 10:12, dn via Python-list wrote: > However, (continuing @Peter's theme) such confuses things when something > goes wrong - was the error in the input() or in the float()? > - particularly for 'beginners' > - and yes, we can expand the above discussion to talk about > error-h

OT: Addition of a .= operator

2023-05-23 Thread dn via Python-list
On 24/05/2023 10.21, Rob Cliffe via Python-list wrote: This sort of code might be better as a single expression. For example: user = ( request.GET["user"] .decode("utf-8") .strip() .lower() ) user = orm.user.get(name=user) LOL.  And I thought I was the one with a (self-co

Re: Addition of a .= operator

2023-05-23 Thread Rob Cliffe via Python-list
On 23/05/2023 22:03, Peter J. Holzer wrote: On 2023-05-21 20:30:45 +0100, Rob Cliffe via Python-list wrote: On 20/05/2023 18:54, Alex Jando wrote: So what I'm suggesting is something like this: hash = hashlib.sha256(b'word') hash.=

Re: Addition of a .= operator

2023-05-23 Thread Chris Angelico
On Wed, 24 May 2023 at 08:57, Rob Cliffe wrote: > > Do you mean "ASCII or UTF-8"? Because decoding as UTF-8 is fine with > > ASCII (it's a superset). You should always consistently get the same > > data type (bytes or text) based on the library you're using. > > > > ChrisA > OK, bad example. The

Re: Addition of a .= operator

2023-05-23 Thread Chris Angelico
On Wed, 24 May 2023 at 08:48, Peter J. Holzer wrote: > > On 2023-05-24 07:12:32 +1000, Chris Angelico wrote: > > On Wed, 24 May 2023 at 07:04, Peter J. Holzer wrote: > > > But I find it easier to read if I just reuse the same variable name: > > > > > > user = request.GET["user"] > > > use

Re: Addition of a .= operator

2023-05-23 Thread Peter J. Holzer
On 2023-05-24 07:12:32 +1000, Chris Angelico wrote: > On Wed, 24 May 2023 at 07:04, Peter J. Holzer wrote: > > But I find it easier to read if I just reuse the same variable name: > > > > user = request.GET["user"] > > user = str(user, encoding="utf-8") > > user = user.strip() > >

Re: Addition of a .= operator

2023-05-23 Thread Rob Cliffe via Python-list
This sort of code might be better as a single expression. For example: user = ( request.GET["user"] .decode("utf-8") .strip() .lower() ) user = orm.user.get(name=user) LOL.  And I thought I was the one with a (self-confessed) tendency to write too slick, dense, smart-alec

Re: Addition of a .= operator

2023-05-23 Thread Chris Angelico
On Wed, 24 May 2023 at 08:22, Rob Cliffe wrote: > > > > This sort of code might be better as a single expression. For example: > > > > user = ( > > request.GET["user"] > > .decode("utf-8") > > .strip() > > .lower() > > ) > > user = orm.user.get(name=user) > > > > > LOL. And I

Re: Addition of a .= operator

2023-05-23 Thread Chris Angelico
On Wed, 24 May 2023 at 07:04, Peter J. Holzer wrote: > But I find it easier to read if I just reuse the same variable name: > > user = request.GET["user"] > user = str(user, encoding="utf-8") > user = user.strip() > user = user.lower() > user = orm.user.get(name=user) > > Each

Re: Addition of a .= operator

2023-05-23 Thread Peter J. Holzer
On 2023-05-21 20:30:45 +0100, Rob Cliffe via Python-list wrote: > On 20/05/2023 18:54, Alex Jando wrote: > > So what I'm suggesting is something like this: > > > > > > hash = hashlib.sha256(b'word') > > hash.=hexdigest() > >

Re: Addition of a .= operator

2023-05-23 Thread Rob Cliffe via Python-list
On 20/05/2023 18:54, Alex Jando wrote: I have many times had situations where I had a variable of a certain type, all I cared about it was one of it's methods. For example: import hashlib hash = hashlib.sha256(b'word') hash = hash.

Re: Is there a Python module to parse a date like the 'date' command in Linux?

2023-05-23 Thread Alex Pinkney
On Tue, 23 May 2023, 17:25 Chris Green, wrote: > Mike Dewhirst wrote: > > [-- multipart/mixed, encoding 7bit, 22 lines --] > > > > [-- text/plain, encoding base64, charset: UTF-8, 16 lines --] > > > > On 21/05/2023 5:53 am, Chris Green wrote: > > > I'm converting a bash script to python as i

Re: Is there a Python module to parse a date like the 'date' command in Linux?

2023-05-23 Thread Chris Green
Mike Dewhirst wrote: > [-- multipart/mixed, encoding 7bit, 22 lines --] > > [-- text/plain, encoding base64, charset: UTF-8, 16 lines --] > > On 21/05/2023 5:53 am, Chris Green wrote: > > I'm converting a bash script to python as it has become rather clumsy > > in bash. > > What is the use