Re: file to bits text and text containing bits to file

2020-10-09 Thread dn via Python-list
On 09/10/2020 19:27, Harshit Sharma wrote: I want to read bits data of all file of any extention in 0s and 1s. And also want to do back means means construct file from bits text data how to do that tell with proof please. I am on a work of something like new sloot method but here I stuck.help

Re: What might cause my sample program to forget that already imported datetime?

2020-10-12 Thread dn via Python-list
On 13/10/2020 06:47, Steve wrote: Thank you, those two fixes took care of the problem. At the top of my sample program, I have: import datetime from datetime import * ... These are incompatible with each other, so you're going to get issues. I'd recommend doing just the first one, and then

Re: File Name issue

2020-10-18 Thread dn via Python-list
On 18/10/2020 12:58, Mladen Gogala via Python-list wrote: On Sat, 17 Oct 2020 22:51:11 +, Mladen Gogala wrote: On Sat, 17 Oct 2020 18:12:16 -0400, Steve wrote: with open("HOURLYLOG.txt", 'r') as infile: works but, when I rename the file, the line: with open("HOURLY-LOG.txt", 'r') as

Re: File Name issue

2020-10-18 Thread dn via Python-list
On 19/10/2020 05:58, Mladen Gogala via Python-list wrote: On Sun, 18 Oct 2020 21:00:18 +1300, dn wrote: On 18/10/2020 12:58, Mladen Gogala via Python-list wrote: On Sat, 17 Oct 2020 22:51:11 +, Mladen Gogala wrote: BTW, I used this cp /var/log/syslog ./in-file.log #!/usr/bin/env python3

Re: How to expand and flatten a nested of list of dictionaries of varied lengths?

2020-10-18 Thread dn via Python-list
On 19/10/2020 09:09, Shaozhong SHI wrote: Even worse is that, in some cases, an addition called serviceRatings as a key occur with new data unexpectedly. "Even worse" than what? Do you need to keep a list of acceptable/applicable/available keys? (and reject or deal with others in some

Re: How to expand and flatten a nested of list of dictionaries of varied lengths?

2020-10-18 Thread dn via Python-list
r 'do some gardening', to remove unnecessary or erroneous material, as the conversation progresses. You will notice (as below) that this also enables a posting with multiple questions, to be discussed point-by-point. Now to work... > On Sun, 18 Oct 2020 at 21:48, dn via Python-list <ma

Re: Help with the best practice to learn python

2020-10-19 Thread dn via Python-list
On 20/10/2020 04:12, Azhar Ansari wrote: Hello Python Community, Kindly help me with the best practice to learn python. Lots of material over net but its very confusing. You are so right - it is very confusing! Different people have different preferences for 'the best way to learn'. Also,

Re: Output showing "None" in Terminal

2020-08-25 Thread dn via Python-list
On 25/08/2020 01:12, Py Noob wrote: Hi! i'm new to python and would like some help with something i was working on from a tutorial. I'm using VScode with 3.7.0 version on Windows 7. Below is my code and the terminal is showing the word "None" everytime I execute my code. Many thanks!

Re: About float/double type number in range.

2020-08-26 Thread dn via Python-list
On 26/08/2020 19:58, Joel Goldstick wrote: On Wed, Aug 26, 2020 at 3:43 AM ADITYA wrote: Dear Sir/Ma’am I am requesting you to satisfy me about float number in Range function, because in the argument of range we can take integer but not double or float whenever double as well

Re: LittleRookie

2020-08-18 Thread dn via Python-list
i would say i'm new at programing i have a year of experience in python(but i'm tottaly a noob) i guess i'm starting to learn SQL now.What should i do to learn better and faster? Enroll in the local college and start your journey there? Successfully finish it and get an internship. Follow with

Re: LittleRookie

2020-08-19 Thread dn via Python-list
On 19/08/2020 14:19, Jamelaumn wrote: actually for me to sign for any online courses like stanford etc... if it's needed any document i couldnt  get in because i have none i'm from brazil :v anyway thank u guys ;) i will try find something Did you try either of the two platforms mentioned

Re: Matrix of size 100*100- Meghna

2020-08-21 Thread dn via Python-list
On 22/08/2020 02:17, Meghna Karkera wrote: Dear Respected Sir I am Meghna, a PhD student. I have installed python in my ubuntu OS from your website recently and tried using spyder and jupyter. May I request you to help me with importing few matrices, each of size 100*100 in python from XLSX

Re: Temporary text for multiple entries

2020-08-21 Thread dn via Python-list
On 22/08/2020 00:01, Ashanti Aggarwal wrote: I am working to make a form where I have added multiple entries. I wish to add temporary text on all of them, as the text to be deleted when clicked and to inserted again when focused out. I have done with the single entry but not able to find a

Re: Issue

2020-08-20 Thread dn via Python-list
On 21/08/2020 07:01, Sreelakshmi Madhu wrote: not able to open IDLE and also while running a program in cmd saved in notepad, it's showing not found such a python file. Please review the Python documentation (https://docs.python.org/3/), in particular the "Python Setup and Usage" notes

Re: Program chaining on Windows

2020-08-23 Thread dn via Python-list
On 23/08/2020 19:31, Rob Cliffe via Python-list wrote: On WIndows 10, running Python programs in a DOS box, I would like one Python program to chain to another.  I.e. the first program to be replaced by the second (*not* waiting for the second to finish, as with e.g. os.system).  This doesn't

Re: Program chaining on Windows

2020-08-23 Thread dn via Python-list
On 24/08/2020 09:04, Chris Angelico wrote: On Mon, Aug 24, 2020 at 6:39 AM dn via Python-list wrote: On 23/08/2020 19:31, Rob Cliffe via Python-list wrote: On WIndows 10, running Python programs in a DOS box, I would like one Python program to chain to another. I.e. the first program

Training Review: Computational Thinking for Problem Solving

2020-08-24 Thread dn via Python-list
Many of us learn Python by memorising code-constructs and their use. Even over-coming this learning-curve is but a small portion of becoming a competent coder or programmer. The challenges of learning how to construct an algorithm, and/or how to analyse a real-world problem to produce a

Re: How to install your personal module/package on site.

2020-08-14 Thread dn via Python-list
On 14/08/2020 22:32, Antoon Pardon wrote: Well the question is in the subject. I have a number of modules/packages which were until recently personal use only. However python is getting more popular at work and some of my work was considered useful enough to install in a public available spot.

Re: A Python installation help doc much more friendly to newcomers? [Was Re: help]

2020-07-18 Thread dn via Python-list
On 18/07/20 11:48 PM, Oscar Benjamin wrote: On Sat, 18 Jul 2020 at 05:39, dn via Python-list wrote: On 18/07/20 3:29 PM, boB Stepp wrote: On Fri, Jul 17, 2020 at 9:48 PM dn via Python-list wrote: On 18/07/20 1:53 PM, Castillo, Herbert S wrote: I downloaded python not to long ago

Re: Python Program Help

2020-07-21 Thread dn via Python-list
On 7/22/20 7:16 AM, Dennis Lee Bieber wrote: On Tue, 21 Jul 2020 06:38:55 -0700 (PDT), ksikor14--- via Python-list declaimed the following: Since this is apparently a homework assignment, I'm not going to provide fixes -- just some comments. Logic error? (not entirely poking-fun: is

Re: "OSError: [Errno 9] Bad file descriptor" When I try to Install the library in conda prompt

2020-07-21 Thread dn via Python-list
On 7/22/20 4:46 PM, Mathiyazhagan S wrote: Dear Sir/Madam, I'm new to the python program. I'm trying to install the "numby" or anything to add into the library by using the windows command prompt I'm getting some error please find the attachment. So please help me to resolve this issue.

Re: Iterators, iterables and special objects

2020-07-21 Thread dn via Python-list
On 7/21/20 9:32 PM, Peter Slížik wrote: Hi list, two related questions: 1. Why do functions used to iterate over collections or dict members return specialized objects like type(dict.keys()) -> class 'dict_keys' type(dict.values()) -> class 'dict_values' type(dict.items()) -> class

Re: How to limit *length* of PrettyPrinter

2020-07-21 Thread dn via Python-list
On 7/22/20 1:31 PM, Stavros Macrakis wrote: I see how to limit the *depth* in pretty-printing: import pprint pprint.PrettyPrinter(depth=2).pprint(((11,12,13),(21,22,23,(241,242,243),25,26,27))) ((11, 12, 13), (21, 22, 23, (...), 25, 26, 27)) But I would also like to limit the *length,

Re: questions re: calendar module

2020-08-01 Thread dn via Python-list
On 01/08/2020 23:36, o1bigtenor wrote: On Sat, Aug 1, 2020 at 1:29 AM dn via Python-list mailto:python-list@python.org>> wrote: On 31/07/2020 02:52, o1bigtenor wrote: > I regularly work in planning through multiple years at once. > This means that I like to have a

Re: questions re: calendar module

2020-08-01 Thread dn via Python-list
On 31/07/2020 02:52, o1bigtenor wrote: I regularly work in planning through multiple years at once. This means that I like to have a lot of stuff available in a calendar function. Python seems to be locked when I need to display more than 1 year at a time. I don't see a way to display something

Re: Updating a variable problem.

2020-08-04 Thread dn via Python-list
On 04/08/2020 20:38, Steve wrote: Why should line 6 fail until line 7 is commented out? Python complains that MSN is "referenced before assignment". def ReadTheEQfile(): global MSN MSN = ("1 Monitor") #This line works every time. def EditTheEQlist(): print("MSN2 = " + MSN) #

Re: Explicit is better than Implicit

2020-08-06 Thread dn via Python-list
On 07/08/2020 05:33, Skip Montanaro wrote: Hmmm... Rename genes, fix Excel, or dump Excel in favor of Python? I know what my choice would have been. :-) https://www.theverge.com/2020/8/6/21355674/human-genes-rename-microsoft-excel-misreading-dates At the risk of screaming off-topic... The

Re: Unable to save any files

2020-08-11 Thread dn via Python-list
On 11/08/2020 21:27, Lim Clayton wrote: Hi, I am a relatively new Python User. I recently downloaded Python on my desktop and I am unable to save anything when I use IDLE. I can run codes on the shell without any issue but running anything on the window which requires saving causes nothing to

Re: importlib: import X as Y; from A import B

2020-08-08 Thread dn via Python-list
On 09/08/2020 15:23, Jason Friedman wrote: I have some code I'm going to share with my team, many of whom are not yet familiar with Python. They may not have 3rd-party libraries such as pandas or selenium installed. Yes I can instruct them how to install, but the path of least resistance is to

Re: Save-to-file code not quite working completely

2020-08-08 Thread dn via Python-list
On 09/08/2020 08:51, Steve wrote: I have a file containing specifications. My .py program can read and manipulate the data but I cannot seem to get it to update the original file properly. The code is simple and works except that the original line remains in the file after the new updated one

Re: questions re: calendar module

2020-08-01 Thread dn via Python-list
On 02/08/2020 12:24, o1bigtenor wrote: On Sat, Aug 1, 2020 at 6:29 PM dn via Python-list wrote: On 01/08/2020 23:36, o1bigtenor wrote: On Sat, Aug 1, 2020 at 1:29 AM dn via Python-list mailto:python-list@python.org>> wrote: On 31/07/2020 02:52, o1bigtenor wrote: > I regul

Re: questions re: calendar module

2020-08-01 Thread dn via Python-list
On 02/08/2020 12:42, o1bigtenor wrote: On Sat, Aug 1, 2020 at 7:24 PM o1bigtenor wrote: On Sat, Aug 1, 2020 at 6:29 PM dn via Python-list wrote: On 01/08/2020 23:36, o1bigtenor wrote: On Sat, Aug 1, 2020 at 1:29 AM dn via Python-list mailto:python-list@python.org>> wrote: On 31/0

Re: Python running in the Command Prompt Window questions

2020-08-03 Thread dn via Python-list
On 03/08/2020 13:52, Steve wrote: When I double click on a .py file, it executes at the command prompt with black background and small white font. Is there python code to change the font size and background color? Ctrl-Shift-+ ? === FootNote: Would it

Re: Support

2020-08-13 Thread dn via Python-list
On 14/08/2020 08:31, Alexa Oña wrote: Helo, I am already subscribed. I De: Alexa Oña Enviado: jueves, 13 de agosto de 2020 18:51 Para: python-list@python.org Asunto: Support Hello, I am Alexa I have tried to install PYTHON 3.8.5, but could not install it on

Whitespace not/required

2020-08-13 Thread dn via Python-list
Although many new-comers are intrigued by the compulsory indentation rule, I have been surprised to discover that even though whitespace does not usually feature as a formatting-specification, nevertheless Python sometimes requires an absence of whitespace. Will this behavior/requirement

Re: Any timeline for PIL for Python 3.4

2020-08-10 Thread dn via Python-list
On 11/08/2020 16:35, Martin wrote: I am running Python 3.4.4, and would like to use the Python Imaging Library (PIL).  This is currently not available for Python Version 3.  Does anybody know when it will become available? Plan B is to install Python 2.7.18.  I just need an idea of how long I

Re: Save-to-file code not quite working completely

2020-08-10 Thread dn via Python-list
On 10/08/2020 05:23, Dennis Lee Bieber wrote: On Sun, 9 Aug 2020 11:50:51 +1200, dn via Python-list declaimed the following: To be a logomach, let's talk about "update":- May I advise that a 'good practice' would be to create a new file, and thus be able to (also) maintain the o

Re: Questioning the effects of multiple assignment

2020-07-07 Thread dn via Python-list
On 7/07/20 7:44 PM, Kyle Stanley wrote: Can you explain why these two (apparently) logical assignment processes have been designed to realise different result-objects? The reason is because of the conventions chosen in PEP 3132, which implemented the feature in the first place. It

Re: Questioning the effects of multiple assignment

2020-07-07 Thread dn via Python-list
On 7/07/20 7:21 PM, Mike Dewhirst wrote: Original message For comparison, here's the original form:- >>> def f( a, *b, c=0 ): ... print( a, type( a ) ) ... print( c, type( c ) ) ... print( b ) ... >>> f( 1, 'two', 3, 'four' ) 1 0 ('two', 3, 'four') Shouldn't

Re: Access last element after iteration

2020-07-07 Thread dn via Python-list
On 8/07/20 12:45 AM, Chris Angelico wrote: On Tue, Jul 7, 2020 at 10:28 PM Frank Millman wrote: Hi all After iterating over a sequence, the final element is still accessible. In this case, the variable 'i' still references the integer 4. Yes, it's guaranteed. It isn't often useful; but

Questioning the effects of multiple assignment

2020-07-07 Thread dn via Python-list
TLDR; if you are a Python 'Master' then feel free to skim the first part (which you should know hands-down), until the excerpts from 'the manual' and from there I'll be interested in learning from you... Yesterday I asked a junior prog to expand an __init__() to accept either a series of

Friday Finking: Limiting parameters

2020-07-10 Thread dn via Python-list
Do you prefer to limit the number of parameters accepted by a single function/method, and if so, how do you handle situations where more data is needed? TLDR; specific questions at the end of this msg Along with one of our list-colleagues (a fellow graduate?survivor from the time of

Re: python software foundation

2020-07-10 Thread dn via Python-list
On 11/07/20 5:19 AM, Chris Angelico wrote: On Sat, Jul 11, 2020 at 3:10 AM Jithesh Thirumaran wrote: please uninstall the site packages of python 3.7.2 and tell me the result thank you The result was 1. @Chris, we should discuss this: A

Re: Friday Finking: Limiting parameters

2020-07-12 Thread dn via Python-list
On 12/07/20 10:10 PM, Barry Scott wrote: On 12 Jul 2020, at 00:15, DL Neil via Python-list mailto:python-list@python.org>> wrote: That does not necessarily mean that the function needs to know the particular representation or form of that data.   Let those be objects with getter methods for

Re: Questioning the effects of multiple assignment

2020-07-08 Thread dn via Python-list
On 8/07/20 2:40 PM, Kyle Stanley wrote: A matter of style, which I like to follow [is it TDD's influence? - or does it actually come-from reading about DBC (Design by Contract*)?] is the injunction that one *not* vary the value of a parameter inside a method/function. (useful

Re: Questioning the effects of multiple assignment

2020-07-08 Thread dn via Python-list
On 8/07/20 11:11 PM, o1bigtenor wrote: On Tue, Jul 7, 2020 at 2:30 AM Mike Dewhirst <mailto:mi...@dewhirst.com.au>> wrote: Original message ----From: dn via Python-list mailto:python-list@python.org>> Date: 7/7/20  16:04  (GMT+10:00) To: 'Python' mai

Re: [BUG] missing ')' causes syntax error on next line

2020-07-22 Thread dn via Python-list
On 23/07/2020 10:33, Chris Angelico wrote: -- Forwarded message - From: Jeff Linahan See attached image. Would be nice if it printed "SyntaxError: unbalanced parens" as it can difficult to see the problem if code like this is run in an environment that only prints the

Re: Fwd: [BUG] missing ')' causes syntax error on next line

2020-07-22 Thread dn via Python-list
On 23/07/2020 11:51, Chris Angelico wrote: On Thu, Jul 23, 2020 at 9:17 AM dn via Python-list wrote: However, questions remain:- Robot: any machine or mechanical device that operates automatically with humanlike skill What about a human that operates mechanically with merely robot-like

Re: Friday Finking: Limiting parameters

2020-07-22 Thread dn via Python-list
On 22/07/2020 05:37, Peter J. Holzer wrote: On 2020-07-13 17:21:40 +1200, dn via Python-list wrote: On 12/07/20 10:10 PM, Barry Scott wrote: I'd expect to see something like this: def mail_label( person, address ): first_name = person.first_name # or if you want a function interface

Re: Fwd: [BUG] missing ')' causes syntax error on next line

2020-07-22 Thread dn via Python-list
On 23/07/2020 10:46, Ethan Furman wrote: On 7/22/20 2:57 PM, Jeff Linahan wrote: Subscribing to the mailing list as per the bot's request and resending. *beep* *whir* WE ARE NOT *click* *whi* A BOT. *bzzzt* WE ARE *bzzzt* *click* ADVANCED LIFE *whi* FORMS *click*

Re: Iterators, iterables and special objects

2020-07-24 Thread dn via Python-list
On 25/07/2020 06:35, Random832 wrote: On Tue, Jul 21, 2020, at 15:54, Terry Reedy wrote: The transformers should be once-through iterators because they can be passed once-through interators. I suppose one could make them iterables and add an attribute 'pristine' set to True in __init__ and

Re: Python pandas Excel

2020-07-17 Thread dn via Python-list
On 18/07/20 3:36 AM, J Conrado wrote: HI, I have an excel file with several columns, the first day/month,/year and hour: Data 01/11/2017 00:00 01/11/2017 03:00 ... Please, how can I get four arrays for day, month, year and hour this column of my excel. What do you have so-far? How are

Re: Python pandas Excel

2020-07-17 Thread dn via Python-list
On 18/07/20 11:06 AM, Dennis Lee Bieber wrote: On Sat, 18 Jul 2020 09:08:50 +1200, dn via Python-list declaimed the following: Assuming the import produces a string, are you able to "slice" the string into the requisite components? Given the OP's stated output -- I wou

Re: Issues in downloading python

2020-07-17 Thread dn via Python-list
On 17/07/20 7:22 PM, Shanmika Sugavaneswaran wrote: Though I install the setup , I couldn’t find Python in my system . I don’t know what cause the problem. Please help me! Please advise if the answer is not already covered in https://docs.python.org/dev/using/windows.html -- Regards =dn --

Re: A Python installation help doc much more friendly to newcomers? [Was Re: help]

2020-07-17 Thread dn via Python-list
On 18/07/20 3:29 PM, boB Stepp wrote: On Fri, Jul 17, 2020 at 9:48 PM dn via Python-list wrote: On 18/07/20 1:53 PM, Castillo, Herbert S wrote: I downloaded python not to long ago, and today when I opened Python on Windows it gave me a modify setup prompt. I have tried to click on modify

Re: excel (multiple sheets) to yml file for each sheet

2020-07-17 Thread dn via Python-list
On 18/07/20 12:04 PM, stack flow wrote: help please. On Thursday, July 16, 2020 at 10:38:23 PM UTC-4, stack flow wrote: Hi, I have excel file with multiple sheets and need output as yml file for each sheet. could someone help me with python code? following is an example: aep sheet: aep

Re: help

2020-07-17 Thread dn via Python-list
On 18/07/20 1:53 PM, Castillo, Herbert S wrote: I downloaded python not to long ago, and today when I opened Python on Windows it gave me a modify setup prompt. I have tried to click on modify , repair and even uninstalled and installed it back, but when I try to open Python up again, I keep

Re: Dowloading package dependencies from locked down machine

2020-07-28 Thread dn via Python-list
On 29/07/2020 07:29, J. Pic wrote: Ideas for solutions: - use pip install --user at home, copy over ~/.local/lib/python3.8/site-packages - same, but with ~/.cache/pip ...or even building an entire parallel Python environment on an Internet-connected machine (even a VM), from which the

Re: Symlinks already present

2020-07-26 Thread dn via Python-list
On 27/07/2020 00:56, Termoregolato wrote: There is any way to check if  a directory is already symlinked, without controlling every symlink viewing the link? That is a bit time consuming, due I've two or three directory that can have a new symlink, but I've to check on a list of 20-3

Re: How to limit *length* of PrettyPrinter

2020-07-23 Thread dn via Python-list
Redirected from Digest (see below) On 23/07/2020 11:59, Stavros Macrakis wrote: > Mousedancer, thanks! Yes, I even look like a (younger) Kevin Costner! (you believe me - right!?) > As a finger exercise, I thought I'd try implementing print-level and print-length as an object-to-object

Re: Spam, bacon, sausage and Spam

2020-07-23 Thread dn via Python-list
On 23/07/2020 20:39, Christian Heimes wrote: On 23/07/2020 02.12, Cameron Simpson wrote: On 22Jul2020 15:00, Christian Heimes wrote: ... would it be possible to reduce the amount of EuroPython spam on @python.org mailing lists to a sensible level? This mailing list is a general discussion

Re: Winreg

2020-07-30 Thread dn via Python-list
On 31/07/2020 07:25, Barry Scott wrote: Use the Reply or Reply-To-All feature of your email program and it will do the rest for you. I can't find instructions for the proper way to reply to 'python list'. Is it simply a matter of keeping the message title identical to the original message

Re: How to limit *length* of PrettyPrinter

2020-07-25 Thread dn via Python-list
Let me preface this reply with the concern that my level of competence, in this area, is insufficient. However, there are a number of folk 'here' who are 'into' Python's internals, and will (hopefully) jump-in... Also, whilst we appear to be concentrating on understanding the content of a

Re: Syntax question

2020-08-16 Thread dn via Python-list
On 16/08/2020 20:12, Klaus Jantzen wrote: Hi, the other day I came across the book "Classic Computer Science Problems in Python" by David Kopec. The function definitions in the examples  like = def fib2(n: int) -> int:     if n < 2:  # base case     return n     return fib2(n -

Re: Whitespace not/required

2020-08-15 Thread dn via Python-list
On 15/08/2020 08:01, Dennis Lee Bieber wrote: On Fri, 14 Aug 2020 16:29:18 +1200, dn via Python-list declaimed the following: it is ignored by Python. (yes, this discussion disdains comments!) For example, whitespace is no problem when it comes to defining a list: month_names = ['Januari

Re: How to install your personal module/package on site.

2020-08-16 Thread dn via Python-list
Does the word "public" mean world-wide, or perhaps only amongst your work-colleagues? Only among work-colleagues. We only want that anyone writing and running python scripts on particular hosts, can easily import these modules/packages. Of possible interest:- Private Python package

Re: A beginning beginner's question about input, output and . . .

2021-01-11 Thread dn via Python-list
On 12/01/2021 09.37, DonK wrote: > > Hi, I'm thinking about learning Python but I'm 74 years old and will > very likely not ever have a programming job again. I used to program > in Visual Basic, C\C++, Delphi, etc. and some obscure "mainframe" > languages. It's been about 18-19 years since my

Re: Environment vars

2020-11-27 Thread dn via Python-list
On 26/11/2020 05:46, Bob van der Poel wrote: I've got a program which accepts an optional env variable listing a single or multiple directory for the app to use. I've done a bit of a search and see both a comma and semicolon being used/suggested as a path separator. Any consensus on which is

Re: Environment vars

2020-11-25 Thread dn via Python-list
On 26/11/2020 08:43, Chris Angelico wrote: On Thu, Nov 26, 2020 at 6:19 AM dn via Python-list wrote: I've got a program which accepts an optional env variable listing a single or multiple directory for the app to use. I've done a bit of a search and see both a comma and semicolon being used

Re: Environment vars

2020-11-25 Thread dn via Python-list
On 26/11/2020 05:46, Bob van der Poel wrote: I've got a program which accepts an optional env variable listing a single or multiple directory for the app to use. I've done a bit of a search and see both a comma and semicolon being used/suggested as a path separator. Any consensus on which is

Re: Environment vars

2020-11-25 Thread dn via Python-list
I've got a program which accepts an optional env variable listing a single or multiple directory for the app to use. I've done a bit of a search and see both a comma and semicolon being used/suggested as a path separator. Any consensus on which is better? ... The one thing I really would *not*

Re: unable to use numpy

2020-11-25 Thread dn via Python-list
On 26/11/2020 06:53, ASHUTOSH SHARMA wrote: Good Evening Welcome to the *world wide* web, where it is also Thursday, and breakfast time (for late risers)!? I had installed numpy and updated to latest version also but getting runtime error pop while using. So please resolve this issue by

Re: Environment vars

2020-11-25 Thread dn via Python-list
Ahha! Didn't know about os.pathsep. Seems simple enough to use that and be done with it. I'm just using str.split() just now. Is there a os.splitpath()? I don't see anything in the docs. https://docs.python.org/3/library/os.path.html#os.path.split -- Regards =dn --

Re: Bot

2020-12-01 Thread dn via Python-list
On 01/12/2020 21:53, Álvaro d'Ors wrote: Hi guys, I'm new here, can anyone help me built a bot than can input data in a website? This is not for spam purposes, I just need to reserve a place in the library at the university but they are completed in a matter of minutes and I can't waste time

Re: Error

2020-12-06 Thread dn via Python-list
On 06/12/2020 07:41, Barry Fitzgerald via Python-list wrote: Good day," I purchased a book for my son and followed the directions to a T. (Coding Games in Python) Whenever I got to the point of of moving the "hello" file over to pgzrun is where my trouble began. Its not finding a path because

Re: Fw: See example

2020-12-04 Thread dn via Python-list
On 05/12/2020 07:57, Arthur R. Ott wrote: ... Microsoft Windows [Version 10.0.19042.630] (c) 2020 Microsoft Corporation. All rights reserved. I am sure you can help me From the Windows10 command line, either in Admin mode or otherwise this is the error message I get. I

Re: Letter replacer - suggestions?

2020-12-07 Thread dn via Python-list
word = input('input word you want to change letters in: ') chars = tuple(word) change_this = input('Enter the letters you want to change: ') replace_with = input('Enter the letters to replace with: ') if len(change_this) != len(replace_with): raise RuntimeError( "Letters to

Re: Letter replacer - suggestions?

2020-12-07 Thread dn via Python-list
On 08/12/2020 12:15, Marco Sulla wrote: On Tue, 8 Dec 2020 at 00:10, dn via Python-list wrote: The translation phase is most easily achieved with the built-in str.translate() I forgot it :-) That's down to the rich-ness of the Python eco-system! IIRC (from previous posts) the OP

Re: Property type hints?

2020-12-09 Thread dn via Python-list
On 09/12/2020 13:17, Paul Bryan wrote: Would this be a reasonably correct way to annotate a property with a type hint? class Foo: ... bar: int If we build a class with (only) the above two lines, Python's help lookup offers the following documentation: <<< Help on Foo in module

Re: Property type hints?

2020-12-09 Thread dn via Python-list
On 10/12/2020 13:06, Paul Bryan wrote: Thanks for the comprehensive response, dn! I guess I'm influenced by data classes here, where the object's attribute type hints are represented by class variable annotations. I'm a great fan of them too - the saving of 'boilerplate code' does it for

Re: A problem with opening a file

2020-11-29 Thread dn via Python-list
On 29/11/2020 20:56, Gabor Urban wrote: Hi, I am facing an issue I was not able to solve yet. I have a class saving messages to a file. The relevant code is: import OS if you're wanting the Python Standard Library, this should not be in upper-case import sys are these two

Re: A problem with opening a file -- again

2020-11-29 Thread dn via Python-list
On 30/11/2020 10:36, Gabor Urban wrote: Hi guys, I tried to solve the problem once again. I have inserted some print statements the check the variables. The actual code (naplo.py) is copy-pasted here: Thanks = helpful +1 @Chris' response! Meantime, what happens if you start python, and

Re: Function returns old value

2020-12-11 Thread dn via Python-list
On 12/12/2020 14:25, Bischoop wrote: I've function asking question and comparing it, if is not matching 'yes' it does call itself to ask question again. The problem is that when function is called second time it returns old value or with additional else statement it returns none. Code:

Re: Function returns old value

2020-12-11 Thread dn via Python-list
On 12/12/2020 15:25, Chris Angelico wrote: On Sat, Dec 12, 2020 at 1:23 PM dn via Python-list wrote: Speaking personally, I prefer the code to be included in the email. However, it would be better to use spaces rather than tabs (Python's preferred style, per PEP-8) because many email packages

Re: Function returns old value

2020-12-11 Thread dn via Python-list
On 12/12/2020 15:09, Bischoop wrote: On 2020-12-12, dn wrote: On 12/12/2020 14:25, Bischoop wrote: I've function asking question and comparing it, if is not matching 'yes' it does call itself to ask question again. The problem is that when function is called second time it returns old

Re: Returning from a multiple stacked call at once

2020-12-12 Thread dn via Python-list
On 13/12/2020 05:46, ast wrote: Le 12/12/2020 à 09:18, Cameron Simpson a écrit : On 12Dec2020 07:39, ast wrote: In case a function recursively calls itself many times, is there a way to return a data immediately without unstacking all functions ? Not really. Do you have an example where

Re: using regex for password validation

2020-12-23 Thread dn via Python-list
On 24/12/2020 12:20, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2020-12-24 at 11:41:15 +1300, dn via Python-list wrote: On 24/12/2020 06:03, Sadaka Technology wrote: hello guys, I have this pattern for password validation (regex): [...] Is it my imagination, or does a password

Re: using regex for password validation

2020-12-23 Thread dn via Python-list
On 24/12/2020 06:03, Sadaka Technology wrote: hello guys, I have this pattern for password validation (regex): I want these rules to be applied: Minimum 8 characters. The alphabets must be between [a-z] At least one alphabet should be of Upper Case [A-Z] At least 1 number or digit between

Re: using regex for password validation

2020-12-23 Thread dn via Python-list
On 24/12/2020 12:25, Chris Angelico wrote: On Thu, Dec 24, 2020 at 9:42 AM dn via Python-list wrote: Hang-on though, look at how much 'work' is involved, compared with a single line of RegEx! Why go to such bother? There's several reasons. Good question! Look at this alternative: def

"Worst bugs" and Python?

2020-12-18 Thread dn via Python-list
TechRepublic have published a lovely piece of 'click-bait' featuring alarmist claims such as "open-source libraries are increasingly untrustworthy" whilst trotting-out tired, old, memes and bias. Don't panic - hold-on to your PyPi! <<< The worst bugs in the top programming languages by

Re: How do you find what exceptions a class can throw?

2020-12-20 Thread dn via Python-list
On 20/12/2020 22:39, Chris Green wrote: I am using poplib.POP3_SSL() and I want to know what exceptions can be thrown when I instantiate it. Presumably it inherits them because there's nothing much in the documentation page for poplib.POP3_SSL(). I specifically want to trap timeout exceptions.

Re: Planet Python

2020-12-14 Thread dn via Python-list
On 12/12/2020 07:22, dn via Python-list wrote: Has something happened to the Planet Python feed? - Last update: December 07, 2020 04:48 PM UTC Fixed! (Thanks!) Although, still reported as an 'open' issue https://github.com/python/planet/issues/446 -- Regards =dn -- https://mail.python.org

Re: dict.get(key, default) evaluates default even if key exists

2020-12-15 Thread dn via Python-list
> On Tue, Dec 15, 2020 at 9:57 AM Mark Polesky via Python-list < > python-list@python.org> wrote: > >> Hi. >> >> # Running this script >> >> D = {'a':1} >> def get_default(): >> print('Nobody expects this') >> return 0 >> print(D.get('a', get_default())) >> >> # ...generates this

Re: dict.get(key, default) evaluates default even if key exists

2020-12-15 Thread dn via Python-list
On 16/12/2020 07:52, Dan Stromberg wrote: ...> BTW, I tend to prefer collections.defaultdict over the two argument D.get or setdefault. Contrarily, dict.get() seems 'better', unless (a) the dict's values are all to be initialised to the same value, eg all None, int 0, or empty list []; or

Planet Python

2020-12-11 Thread dn via Python-list
Has something happened to the Planet Python feed? - Last update: December 07, 2020 04:48 PM UTC -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Function returns old value

2020-12-16 Thread dn via Python-list
On 17/12/2020 16:06, Bischoop wrote: On 2020-12-17, dn wrote: Remember that posts to the list are archived, and thus may be searched. People experiencing similar problems in-future will be able to 'mine' the archives for help and advice. Using a/any pastebin is great for immediate sharing.

Re: Function returns old value

2020-12-16 Thread dn via Python-list
On 17/12/2020 15:40, Bischoop wrote: On 2020-12-12, Terry Reedy wrote: Don't post links to unknown sites. Reduce it to the minimum needed to exhibit the questionable behavior and include inline with the question. BTW bpa.st/+python is well known for code sharing among Python communities

Re: How can I make this more complex?

2020-11-09 Thread dn via Python-list
On 10/11/2020 10:04, Quentin Bock wrote: grade = input("Enter your grade: ") if grade >= 90: print("You got an A ") if grade >= 80: print("You got a B ") if grade >= 70: print("You got a C") if grade >= 60: print("You got a D ") if grade >= 50: print("You failed")

Re: returning totals in functions of math

2020-11-08 Thread dn via Python-list
Comments interposed:- On 09/11/2020 08:14, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2020-11-08 at 19:00:34 +, Peter Pearson wrote: On Sun, 8 Nov 2020 13:50:19 -0500, Quentin Bock wrote: Errors say that add takes 1 positional argument but 3 were given? Does this limit how many

Re: returning totals in functions of math

2020-11-08 Thread dn via Python-list
On 09/11/2020 09:41, Quentin Bock wrote: Okay, thank you :) I didn't understand about 90% of what you explained lol (sorry) but the sum worked and I have the correct answer. Also, do you know any numbers that could replace 1 in this function as the total? just curious Thanks :) Yes,

  1   2   3   4   >