Re: Fwd: Installation hell

2022-12-19 Thread DFS
On 12/18/2022 6:50 AM, Jim Lewis wrote: I'm an occasional user of Python and have a degree in computer science. Almost every freaking time I use Python, I go through PSH (Python Setup Hell). Sometimes a wrong version is installed. Sometimes it's a path issue. Or exe naming confusion: python, pyth

Re: How to get the needed version of a dependency

2022-12-14 Thread DFS
On 12/14/2022 3:55 AM, Cecil Westerhof wrote: If I want to know the dependencies for requests I use: pip show requests And one of the lines I get is: Requires: certifi, charset-normalizer, idna, urllib3 But I want (in this case) to know with version of charset-normalizer requests need

Re: Does one have to use curses to read single characters from keyboard?

2022-12-11 Thread DFS
On 12/11/2022 5:09 AM, Chris Green wrote: Is the only way to read single characters from the keyboard to use curses.cbreak() or curses.raw()? If so how do I then read characters, it's not at all obvious from the curses documentation as that seems to think I'm using a GUI in some shape or form.

Re: New computer, new Python

2022-12-09 Thread DFS
On 12/9/2022 12:13 PM, ker...@polaris.net wrote: Hello. I've downloaded the new Python to my new Computer, and the new Python mystifies me. Instead of an editor, it looks like a Dos executable program. python.exe is a Windows executable. How can I write my own Python Functions and

Python is maybe the most widely used language, but clp gets 0 posts some days?

2022-12-02 Thread DFS
Usenet is dead. Long live Usenet. -- https://mail.python.org/mailman/listinfo/python-list

Re: Vb6 type to python

2022-11-30 Thread DFS
On 11/30/2022 1:07 PM, DFS wrote: On 11/30/2022 6:56 AM, luca72.b...@gmail.com wrote: I don't do Python OO so someone else can answer better, but a simple port of your VB type would be a python class definition: class prog_real:     codice, denom, codprof, note, programmer    

Re: Vb6 type to python

2022-11-30 Thread DFS
On 11/30/2022 6:56 AM, luca72.b...@gmail.com wrote: Hello i have a byte file, that fill a vb6 type like: Type prog_real codice As String * 12'hsg denom As String * 24'oo codprof As String * 12 'ljio note As String * 100 programmer As String * 11

Re: Python 3.11.0 installation and Tkinter does not work

2022-11-21 Thread DFS
On 11/21/2022 12:59 PM, darkst...@o2online.de wrote: Dear list, I want learn python for 4 weeks and have problems, installing Tkinter. If I installed 3.11.0 for my windows 8.1 from python.org and type   >>> import _tkinter > Traceback (most recent call last): >    File "",

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-13 Thread DFS
On 11/13/2022 9:11 PM, Chris Angelico wrote: On Mon, 14 Nov 2022 at 11:53, DFS wrote: On 11/13/2022 5:20 PM, Jon Ribbens wrote: On 2022-11-13, DFS wrote: In code, list.clear is just ignored. At the terminal, list.clear shows in code: x = [1,2,3] x.clear print(len(x)) 3 at terminal: x

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-13 Thread DFS
On 11/13/2022 5:20 PM, Jon Ribbens wrote: On 2022-11-13, DFS wrote: In code, list.clear is just ignored. At the terminal, list.clear shows in code: x = [1,2,3] x.clear print(len(x)) 3 at terminal: x = [1,2,3] x.clear print(len(x)) 3 Caused me an hour of frustration before I noticed

In code, list.clear doesn't throw error - it's just ignored

2022-11-13 Thread DFS
In code, list.clear is just ignored. At the terminal, list.clear shows in code: x = [1,2,3] x.clear print(len(x)) 3 at terminal: x = [1,2,3] x.clear print(len(x)) 3 Caused me an hour of frustration before I noticed list.clear() was what I needed. x = [1,2,3] x.clear() print(len(x)) 0 --

Re: Need max values in list of tuples, based on position

2022-11-13 Thread DFS
On 11/13/2022 7:37 AM, Pancho wrote: On 11/11/2022 19:56, DFS wrote: Edit: found a solution online: - x = [(11,1,1),(1,41,2),(9,3,12)] maxvals = [0]*len(x[0]) for e in x:  maxvals = [max(w,int(c)) for w,c in zip(maxvals,e

Re: Need max values in list of tuples, based on position

2022-11-11 Thread DFS
On 11/11/2022 7:04 PM, Dennis Lee Bieber wrote: On Fri, 11 Nov 2022 15:03:49 -0500, DFS declaimed the following: Thanks for looking at it. I'm trying to determine the maximum length of each column result in a SQL query. Normally you can use the 3rd value of the cursor.description o

Re: Need max values in list of tuples, based on position

2022-11-11 Thread DFS
On 11/11/2022 2:22 PM, Pancho wrote: On 11/11/2022 18:53, DFS wrote: On 11/11/2022 12:49 PM, Dennis Lee Bieber wrote: On Fri, 11 Nov 2022 02:22:34 -0500, DFS declaimed the following: [(0,11), (1,1),  (2,1),   (0,1) , (1,41), (2,2),   (0,9) , (1,3),  (2,12)] The set of values in elements[0

Re: Need max values in list of tuples, based on position

2022-11-11 Thread DFS
On 11/11/2022 7:50 AM, Stefan Ram wrote: Pancho writes: def build_max_dict( tups): dict = {} for (a,b) in tups: if (a in dict): if (b>dict[a]): dict[a]=b else: dict[a]=b return(sorted(dict.values())) Or, import it

Need max values in list of tuples, based on position

2022-11-11 Thread DFS
[(0,11), (1,1), (2,1), (0,1) , (1,41), (2,2), (0,9) , (1,3), (2,12)] The set of values in elements[0] is {0,1,2} I want the set of max values in elements[1]: {11,41,12} -- https://mail.python.org/mailman/listinfo/python-list

Re: Need max values in list of tuples, based on position

2022-11-11 Thread DFS
On 11/11/2022 12:49 PM, Dennis Lee Bieber wrote: On Fri, 11 Nov 2022 02:22:34 -0500, DFS declaimed the following: [(0,11), (1,1), (2,1), (0,1) , (1,41), (2,2), (0,9) , (1,3), (2,12)] The set of values in elements[0] is {0,1,2} I want the set of max values in elements[1]: {11,41,12

Re: What's tkinter doing in \Lib\site-packages\future\moves ?

2022-11-08 Thread DFS
On 11/7/2022 10:48 PM, DFS wrote: 3.9.13 Never mind. User error - I didn't install it in the first place. -- https://mail.python.org/mailman/listinfo/python-list

What's tkinter doing in \Lib\site-packages\future\moves ?

2022-11-07 Thread DFS
3.9.13 -- https://mail.python.org/mailman/listinfo/python-list

Re: Any PyQt developers here?

2022-10-28 Thread DFS
On 10/27/2022 3:47 PM, Thomas Passin wrote: On 10/27/2022 11:15 AM, DFS wrote: On 10/25/2022 1:45 PM, Thomas Passin wrote: On 10/25/2022 1:03 PM, DFS wrote: Having problems with removeRow() on a QTableView object. removeRow() isn't listed as being a method of a QTableView, not eve

Re: Any PyQt developers here?

2022-10-27 Thread DFS
On 10/25/2022 1:45 PM, Thomas Passin wrote: On 10/25/2022 1:03 PM, DFS wrote: Having problems with removeRow() on a QTableView object. removeRow() isn't listed as being a method of a QTableView, not even an inherited method, so how are you calling removeRow() on it? (See https://doc.

A little source file analyzer

2022-10-26 Thread DFS
Nothing special, but kind of fun to use $python progname.py sourcefile.py - #count blank lines, comments, source code import sys #counters imports, blanks,comments, source = 0,0,0,0 functions, dbexec, total = 0,0,0 #python builtins bui

Re: Any PyQt developers here?

2022-10-26 Thread DFS
On 10/25/2022 2:03 PM, Barry Scott wrote: There is an active PyQt mailing list that has lots of helpful and knowledgeable people on it. https://www.riverbankcomputing.com/mailman/listinfo/pyqt Barry Thanks. I'll send some questions their way, I'm sure. -- https://mail.python.org/mailman/li

Re: Any PyQt developers here?

2022-10-26 Thread DFS
On 10/25/2022 1:45 PM, Thomas Passin wrote: On 10/25/2022 1:03 PM, DFS wrote: Having problems with removeRow() on a QTableView object. removeRow() isn't listed as being a method of a QTableView, not even an inherited method, so how are you calling removeRow() on it? (See https://doc.

Any PyQt developers here?

2022-10-25 Thread DFS
Having problems with removeRow() on a QTableView object. After calling removeRow(), the screen isn't updating. It's as if the model is read-only, but it's a QSqlTableModel() model, which is not read-only. The underlying SQL is straightforward (one table) and all columns are editable. None

Quick question about CPython interpreter

2022-10-17 Thread DFS
- this does a str() conversion in the loop - for i in range(cells.count()): if text == str(ID): break

Re: Uninstall tool not working.

2022-09-14 Thread DFS
On 9/13/2022 3:54 PM, Salvatore Bruzzese wrote: Hi, I was trying to uninstall version 3.10.7 of python but I've encountered problems with the uninstall tool. I open the python setup program, click on the uninstall button but it doesn't even start deleting python even though it says that the proce

Re: Obtain the query interface url of BCS server.

2022-09-14 Thread DFS
On 9/13/2022 7:29 PM, hongy...@gmail.com wrote: On Tuesday, September 13, 2022 at 9:33:20 PM UTC+8, DFS wrote: On 9/13/2022 3:46 AM, hongy...@gmail.com wrote: On Tuesday, September 13, 2022 at 4:20:12 AM UTC+8, DFS wrote: On 9/12/2022 5:00 AM, hongy...@gmail.com wrote: I want to do the query

Re: Obtain the query interface url of BCS server.

2022-09-13 Thread DFS
On 9/13/2022 3:46 AM, hongy...@gmail.com wrote: On Tuesday, September 13, 2022 at 4:20:12 AM UTC+8, DFS wrote: On 9/12/2022 5:00 AM, hongy...@gmail.com wrote: I want to do the query from with in script based on the interface here [1]. For this purpose, the underlying posting URL must be

Re: Obtain the query interface url of BCS server.

2022-09-12 Thread DFS
On 9/12/2022 5:00 AM, hongy...@gmail.com wrote: I want to do the query from with in script based on the interface here [1]. For this purpose, the underlying posting URL must be obtained, say, the URL corresponding to "ITA Settings" button, so that I can make the corresponding query URL and issu

Re: Flush / update GUIs in PyQt5 during debugging in PyCharm

2021-09-24 Thread DFS
On 9/24/2021 12:46 AM, Mohsen Owzar wrote: Hi Guys I've written a GUI using PyQt5 and in there I use StyleSheets (css) for the buttons and labels to change their background- and foreground-colors and their states as well. Because my program doesn't function correctly, I try to debug it in my ID

Re: Free OCR package in Python and selecting appropriate widget for the GUI

2021-09-22 Thread DFS
On 9/22/2021 1:54 AM, Mohsen Owzar wrote: DFS schrieb am Mittwoch, 22. September 2021 um 05:10:30 UTC+2: On 9/21/2021 10:38 PM, Mohsen Owzar wrote: DFS schrieb am Dienstag, 21. September 2021 um 15:45:38 UTC+2: On 9/21/2021 4:36 AM, Mohsen Owzar wrote: Hi Guys Long time ago I've writ

Re: Free OCR package in Python and selecting appropriate widget for the GUI

2021-09-22 Thread DFS
On 9/21/2021 10:38 PM, Mohsen Owzar wrote: DFS schrieb am Dienstag, 21. September 2021 um 15:45:38 UTC+2: On 9/21/2021 4:36 AM, Mohsen Owzar wrote: Hi Guys Long time ago I've written a program in Malab a GUI for solving Sudoku puzzles, which worked not so bad. Now I try to write this GUI

Re: Free OCR package in Python and selecting appropriate widget for the GUI

2021-09-21 Thread DFS
On 9/21/2021 4:36 AM, Mohsen Owzar wrote: Hi Guys Long time ago I've written a program in Malab a GUI for solving Sudoku puzzles, which worked not so bad. Now I try to write this GUI with Python with PyQt5 or TKinter. First question is: Is there any free OCR software, packages or code in Python,

Re: Question again

2021-09-16 Thread DFS
On 9/16/2021 1:50 AM, af kh wrote: Hello, I was doing some coding on a website called replit then I extracted the file, and opened it in Python. For some reason, after answering 'no' or 'yes' after the last sentence I wrote, the Python window shut off, in replit I added one more sentence, but

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-15 Thread DFS
On 9/15/2021 5:10 PM, Mostowski Collapse wrote: And how do you only iterate over n-1 elements? I don't need a loop over all elements. With array slicing? Someting like: for item in items[0:len(items)-2]: ___print(item) Or with negative slicing indexes? Problem is my length can be equal to one

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-15 Thread DFS
On 9/15/2021 12:23 PM, Mostowski Collapse wrote: I really wonder why my Python implementation is a factor 40 slower than my JavaScript implementation. Structurally its the same code. You can check yourself: Python Version: https://github.com/jburse/dogelog-moon/blob/main/devel/runtimepy/machine

Re: Connecting python to DB2 database

2021-09-04 Thread DFS
On 9/3/2021 9:50 AM, Chris Angelico wrote: On Fri, Sep 3, 2021 at 11:37 PM DFS wrote: On 9/3/2021 1:47 AM, Chris Angelico wrote: On Fri, Sep 3, 2021 at 3:42 PM DFS wrote: Having a problem with the DB2 connector test.py

Re: Help me split a string into elements

2021-09-04 Thread DFS
On 9/4/2021 5:55 PM, DFS wrote: Typical cases:  lines = [('one\ntwo\nthree\n')]  print(str(lines[0]).splitlines())  ['one', 'two', 'three']  lines = [('one two three\n')]  print(str(lines[0]).split())  ['one', 'two',

Help me split a string into elements

2021-09-04 Thread DFS
Typical cases: lines = [('one\ntwo\nthree\n')] print(str(lines[0]).splitlines()) ['one', 'two', 'three'] lines = [('one two three\n')] print(str(lines[0]).split()) ['one', 'two', 'three'] That's the result I'm wanting, but I get data in a slightly different format: lines = [('one\ntwo\

Re: Connecting python to DB2 database

2021-09-03 Thread DFS
On 9/3/2021 1:47 AM, Chris Angelico wrote: On Fri, Sep 3, 2021 at 3:42 PM DFS wrote: Having a problem with the DB2 connector test.py import ibm_db_dbi connectstring = 'DATABASE=xxx;HOSTNAME=localhost;PORT=5;PROTOCOL=

Connecting python to DB2 database

2021-09-02 Thread DFS
Having a problem with the DB2 connector test.py import ibm_db_dbi connectstring = 'DATABASE=xxx;HOSTNAME=localhost;PORT=5;PROTOCOL=TCPIP;UID=xxx;PWD=xxx;' conn = ibm_db_dbi.connect(connectstring,'','') curr = conn.cursor pri

Re: pylint woes

2016-05-10 Thread DFS
On 5/7/2016 10:50 PM, Chris Angelico wrote: On Sun, May 8, 2016 at 12:15 PM, DFS wrote: The only reason for j in range(len(list1)): do something with list1[j], list2[j], list3[j], etc. or for item1, item2, item3 in zip(list1, list2, list3): do something with the items works is

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-10 Thread DFS
On 5/10/2016 2:15 PM, Ian Kelly wrote: On Tue, May 10, 2016 at 10:16 AM, DFS wrote: On 5/9/2016 3:53 AM, Steven D'Aprano wrote: On Monday 09 May 2016 09:10, DFS wrote: sSQL = "line 1\n" sSQL += "line 2\n" sSQL += "line 3" Pointlessly provocative

Re: Pylint prefers list comprehension over filter...

2016-05-10 Thread DFS
On 5/10/2016 3:34 PM, Terry Reedy wrote: On 5/10/2016 9:51 AM, Claudiu Popa wrote: Thank you for letting us know. While pylint is indeed opinionated in some cases, we're not trying to be "arrogant", as you put it, towards Guido or the other core developers. What's sad in this particular case is

Re: An educational site written in Python (from YCombinator's RFS)

2016-05-10 Thread DFS
On 5/10/2016 2:13 AM, Cai Gengyang wrote: Ok, so after reading YCombinator's RFS, I have decided that I want to work on this : --- EDUCATION If we can fix education, we can eventua

The irony

2016-05-10 Thread DFS
"There should be one-- and preferably only one --obvious way to do it." https://www.python.org/dev/peps/pep-0020/ --- sSQL = "line 1\n" sSQL += "line 2\n" sSQL += "line 3" --- sSQL = ("line 1\n" "line 2\n" "line 3"

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-10 Thread DFS
On 5/9/2016 3:53 AM, Steven D'Aprano wrote: On Monday 09 May 2016 09:10, DFS wrote: sSQL = "line 1\n" sSQL += "line 2\n" sSQL += "line 3" Pointlessly provocative subject line edited. huh? You call

Is there a reason zip() wipes out data?

2016-05-08 Thread DFS
python 2.7.11 docs: "The returned list is truncated in length to the length of the shortest argument sequence." a = ['who','let','the'] b = ['dogs','out?'] c = zip(a,b) print c [('who', 'dogs'), ('let', 'out?')] Wouldn't it be better to return an empty element than silently kill your data?

Re: pylint woes

2016-05-08 Thread DFS
On 5/8/2016 9:17 PM, Gregory Ewing wrote: Stephen Hansen wrote: The point is, you don't usually commit after an error happens. You rollback. He might want to commit the ones that *did* go in. That's not necessarily wrong. It all depends on the surrounding requirements and workflow. Bingo.

Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-08 Thread DFS
sSQL = "line 1\n" sSQL += "line 2\n" sSQL += "line 3" -- https://mail.python.org/mailman/listinfo/python-list

Re: pylint woes

2016-05-08 Thread DFS
On 5/8/2016 6:05 PM, Stephen Hansen wrote: On Sun, May 8, 2016, at 02:46 PM, DFS wrote: On 5/8/2016 5:38 PM, Stephen Hansen wrote: On Sun, May 8, 2016, at 02:16 PM, DFS wrote: I was surprised to see the PEP8 guide approve of: "Yes: if x == 4: print x, y; x, y = y, x" https://www.

Re: pylint woes

2016-05-08 Thread DFS
On 5/8/2016 5:38 PM, Stephen Hansen wrote: On Sun, May 8, 2016, at 02:16 PM, DFS wrote: I was surprised to see the PEP8 guide approve of: "Yes: if x == 4: print x, y; x, y = y, x" https://www.python.org/dev/peps/pep-0008/#pet-peeves That is not approving of that line of code as so

Re: pylint woes

2016-05-08 Thread DFS
On 5/8/2016 7:36 AM, Steven D'Aprano wrote: On Sun, 8 May 2016 11:16 am, DFS wrote: address data is scraped from a website: names = tree.xpath() addr = tree.xpath() Why are you scraping the data twice? Because it exists in 2 different sections of the document. names = tree.

Re: pylint woes

2016-05-08 Thread DFS
On 5/8/2016 1:25 PM, Steven D'Aprano wrote: On Sun, 8 May 2016 02:10 pm, DFS wrote: +-++ |bad-whitespace |65 | mostly because I line up = signs:

Re: pylint woes

2016-05-08 Thread DFS
On 5/8/2016 11:15 AM, Chris Angelico wrote: On Mon, May 9, 2016 at 1:06 AM, DFS wrote: On 5/8/2016 10:36 AM, Chris Angelico wrote: On Mon, May 9, 2016 at 12:25 AM, DFS wrote: for category,name,street,city,state,zipcode in ziplists: try: db.execute(cSQL, vals) except

Re: pylint woes

2016-05-08 Thread DFS
On 5/7/2016 2:43 PM, Peter Pearson wrote: On Sat, 7 May 2016 12:51:00 -0400, DFS wrote: This more-anal-than-me program generated almost 2 warnings for every line of code in my program. w t hey? Thank you for putting a sample of pylint output in front of my eyes; you inspired me to install

Re: pylint woes

2016-05-08 Thread DFS
On 5/8/2016 11:51 AM, Steven D'Aprano wrote: On Mon, 9 May 2016 12:25 am, DFS wrote: for j in range(len(nms)): cSQL = "INSERT INTO ADDRESSES VALUES (?,?,?,?,?)" vals = nms[j],street[j],city[j],state[j],zipcd[j] Why are you assigning cSQL to the same string over and

Re: pylint woes

2016-05-08 Thread DFS
On 5/8/2016 10:36 AM, Chris Angelico wrote: On Mon, May 9, 2016 at 12:25 AM, DFS wrote: for category,name,street,city,state,zipcode in ziplists: try: db.execute(cSQL, vals) except (pyodbc.Error) as programError: if str(programError).find("UNIQUE constraint failed&

Re: pylint woes

2016-05-08 Thread DFS
On 5/7/2016 11:46 PM, Stephen Hansen wrote: On Sat, May 7, 2016, at 08:04 PM, DFS wrote: The lists I actually use are: for j in range(len(nms)): cSQL = "INSERT INTO ADDRESSES VALUES (?,?,?,?,?)" vals = nms[j],street[j],city[j],state[j],zipcd[j] The enumerated versio

Re: pylint woes

2016-05-08 Thread DFS
On 5/8/2016 1:50 AM, Jussi Piitulainen wrote: DFS writes: The lists I actually use are: for j in range(len(nms)): cSQL = "INSERT INTO ADDRESSES VALUES (?,?,?,?,?)" vals = nms[j],street[j],city[j],state[j],zipcd[j] The enumerated version would be: ziplists = zip(nms,s

Re: pylint woes

2016-05-07 Thread DFS
On 5/7/2016 11:51 PM, Chris Angelico wrote: On Sun, May 8, 2016 at 1:28 PM, DFS wrote: Invalid constant name "cityzip" (invalid-name) Invalid constant name "state" (invalid-name) Invalid constant name "miles" (invalid-name) Invalid constant name "store"

Re: pylint woes

2016-05-07 Thread DFS
On 5/7/2016 11:25 PM, Steven D'Aprano wrote: On Sun, 8 May 2016 02:51 am, DFS wrote: This more-anal-than-me program generated almost 2 warnings for every line of code in my program. w t hey? DFS com

Re: pylint woes

2016-05-07 Thread DFS
On 5/7/2016 2:52 PM, Christopher Reimer wrote: On 5/7/2016 9:51 AM, DFS wrote: Has anyone ever in history gotten 10/10 from pylint for a non-trivial program? I routinely get 10/10 for my code. While pylint isn't perfect and idiosyncratic at times, it's a useful tool to help

Re: pylint woes

2016-05-07 Thread DFS
On 5/7/2016 3:40 PM, Terry Reedy wrote: On 5/7/2016 12:51 PM, DFS wrote: This more-anal-than-me program generated almost 2 warnings for every line of code in my program. w t hey? If you don't like it, why do you use it? I've never used it before last night. I was shocked

Re: pylint woes

2016-05-07 Thread DFS
On 5/7/2016 10:14 PM, Stephen Hansen wrote: On Sat, May 7, 2016, at 06:16 PM, DFS wrote: Why is it better to zip() them up and use: for item1, item2, item3 in zip(list1, list2, list3): do something with the items than for j in range(len(list1)): do something with list1[j], list2[j

Re: pylint woes

2016-05-07 Thread DFS
On 5/7/2016 9:36 PM, Chris Angelico wrote: On Sun, May 8, 2016 at 11:16 AM, DFS wrote: On 5/7/2016 1:01 PM, Chris Angelico wrote: The suggestion from a human would be to use zip(), or possibly to change your data structures. Happens like this: address data is scraped from a website

Re: pylint woes

2016-05-07 Thread DFS
On 5/7/2016 1:01 PM, Chris Angelico wrote: On Sun, May 8, 2016 at 2:51 AM, DFS wrote: [1] pylint says "Consider using enumerate instead of iterating with range and len" the offending code is: for j in range(len(list1)): do something with list1[j], list2[j], list3[j], etc. enumera

pylint woes

2016-05-07 Thread DFS
This more-anal-than-me program generated almost 2 warnings for every line of code in my program. w t hey? DFS comments +-++ --- |message id |occurrences

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread DFS
On 5/6/2016 7:29 PM, Ethan Furman wrote: On 05/06/2016 04:12 PM, DFS wrote: On 5/6/2016 4:30 PM, MRAB wrote: If you don't want to use the 'with' statement, note that closing the file is: f.close() It needs the "()"! I used close() in 1 place, bu

Re: A fun python CLI program for all to enjoy!

2016-05-06 Thread DFS
On 5/6/2016 4:30 PM, MRAB wrote: On 2016-05-06 20:10, DFS wrote: getAddresses.py Scrapes addresses from www.usdirectory.com and stores them in a SQLite database, or writes them to text files for mailing labels, etc Now, just by typing 'fast food Taco Bell 10 db all' you can find ou

Re: Whittle it on down

2016-05-06 Thread DFS
On 5/6/2016 11:44 AM, Peter Otten wrote: DFS wrote: There are up to 4 levels of categorization: http://www.usdirectory.com/cat/g0 shows 21 Level 1 categories, and 390 Level 2. To get the Level 3 and 4 you have to drill-down using the hyperlinks. How to do it in python code is beyond my

A fun python CLI program for all to enjoy!

2016-05-06 Thread DFS
getAddresses.py Scrapes addresses from www.usdirectory.com and stores them in a SQLite database, or writes them to text files for mailing labels, etc Now, just by typing 'fast food Taco Bell 10 db all' you can find out how many Taco Bells are within 10 miles of you, and store all the addres

Re: Whittle it on down

2016-05-06 Thread DFS
On 5/6/2016 9:58 AM, DFS wrote: On 5/6/2016 3:45 AM, Peter Otten wrote: DFS wrote: Should've looked earlier. Their master list of categories http://www.usdirectory.com/cat/g0 shows a few commas, a bunch of dashes, and the ampersands we talked about. "OFFICE SERVICES, SUPPLIES &

Re: Whittle it on down

2016-05-06 Thread DFS
On 5/6/2016 3:45 AM, Peter Otten wrote: DFS wrote: Should've looked earlier. Their master list of categories http://www.usdirectory.com/cat/g0 shows a few commas, a bunch of dashes, and the ampersands we talked about. "OFFICE SERVICES, SUPPLIES & EQUIPMENT" gets removed b

Re: Whittle it on down

2016-05-05 Thread DFS
On 5/5/2016 1:39 AM, Stephen Hansen wrote: Given: input = [u'Espa\xf1ol', 'Health & Fitness Clubs (36)', 'Health Clubs & Gymnasiums (42)', 'Health Fitness Clubs', 'Name', 'Atlanta city guide', 'edit address', 'Tweet', 'PHYSICAL FITNESS CONSULTANTS & TRAINERS', 'HEALTH CLUBS & GYMNASIUMS', 'H

Re: Whittle it on down

2016-05-05 Thread DFS
On 5/5/2016 2:56 PM, Stephen Hansen wrote: On Thu, May 5, 2016, at 05:31 AM, DFS wrote: You are out of your mind. Whoa, now. I might disagree with Steven D'Aprano about how to approach this problem, but there's no need to be rude. Seriously not trying to be rude - more smart-a

Re: Whittle it on down

2016-05-05 Thread DFS
On 5/5/2016 1:54 PM, Steven D'Aprano wrote: On Thu, 5 May 2016 10:31 pm, DFS wrote: You are out of your mind. That's twice you've tried to put me down, first by dismissing my comments about text processing with "Linguist much", and now an outright insult. The first

Re: Whittle it on down

2016-05-05 Thread DFS
On 5/5/2016 9:32 AM, Stephen Hansen wrote: On Thu, May 5, 2016, at 12:36 AM, Steven D'Aprano wrote: Oh, a further thought... On Thursday 05 May 2016 16:46, Stephen Hansen wrote: I don't even care about faster: Its overly complicated. Sometimes a regular expression really is the clearest way to

Re: Whittle it on down

2016-05-05 Thread DFS
On 5/5/2016 1:53 AM, Jussi Piitulainen wrote: Either way is easy to approximate with a regex: import re upper = re.compile(r'[A-Z &]+') lower = re.compile(r'[^A-Z &]') print([datum for datum in data if upper.fullmatch(datum)]) print([datum for datum in data if not lower.search(datum)]) This

Re: Whittle it on down

2016-05-05 Thread DFS
On 5/5/2016 1:39 AM, Stephen Hansen wrote: pattern = re.compile(r"^[A-Z\s&]+$") output = [x for x in list if pattern.match(x)] Holy Shr"^[A-Z\s&]+$" One line of parsing! I was figuring a few list comprehensions would do it - this is better. (note: the reason I specified 'spaces aroun

Re: Whittle it on down

2016-05-05 Thread DFS
On 5/5/2016 2:04 AM, Steven D'Aprano wrote: On Thursday 05 May 2016 14:58, DFS wrote: Want to whittle a list like this: [...] Want to keep all elements containing only upper case letters or upper case letters and ampersand (where ampersand is surrounded by spaces) Start by writ

Re: No SQLite newsgroup, so I'll ask here about SQLite, python and MS Access

2016-05-04 Thread DFS
On 5/4/2016 10:02 PM, Stephen Hansen wrote: On Wed, May 4, 2016, at 03:46 PM, DFS wrote: I can't find anything on the web. Have you tried: http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users If you really must access it over a newsgroup, you can use the Gmane m

Whittle it on down

2016-05-04 Thread DFS
Want to whittle a list like this: [u'Espa\xf1ol', 'Health & Fitness Clubs (36)', 'Health Clubs & Gymnasiums (42)', 'Health Fitness Clubs', 'Name', 'Atlanta city guide', 'edit address', 'Tweet', 'PHYSICAL FITNESS CONSULTANTS & TRAINERS', 'HEALTH CLUBS & GYMNASIUMS', 'HEALTH CLUBS & GYMNASIUMS',

No SQLite newsgroup, so I'll ask here about SQLite, python and MS Access

2016-05-04 Thread DFS
Both of the following python commands successfully create a SQLite3 datafile which crashes Access 2003 immediately upon trying to open it (via an ODBC linked table). import sqlite3 conn = sqlite3.connect("dfile.db") import pyodbc conn = pyodbc.connect('Driver={SQLite3 ODBC Driver};Database=

Re: Not x.islower() has different output than x.isupper() in list output...

2016-05-04 Thread DFS
On 5/4/2016 11:37 AM, Steven D'Aprano wrote: On Thu, 5 May 2016 12:09 am, DFS wrote: On 5/3/2016 11:28 PM, Steven D'Aprano wrote: Languages with two distinct lettercases, like English, are called bicameral. [...] Linguist much? Possibly even a cunning one. I see you as

Re: Not x.islower() has different output than x.isupper() in list output...

2016-05-04 Thread DFS
On 5/3/2016 11:28 PM, Steven D'Aprano wrote: On Wed, 4 May 2016 12:49 am, Jussi Piitulainen wrote: DFS writes: On 5/3/2016 9:13 AM, Chris Angelico wrote: It doesn't invert, the way numeric negation does. What do you mean by 'case inverted'? It looks like it swap

Re: Fastest way to retrieve and write html contents to file

2016-05-03 Thread DFS
On 5/3/2016 2:41 PM, Tim Chase wrote: On 2016-05-03 13:00, DFS wrote: On 5/3/2016 11:28 AM, Tim Chase wrote: On 2016-05-03 00:24, DFS wrote: One small comparison I was able to make was VBA vs python/pyodbc to summarize an Access database. Not quite a fair test, but interesting nonetheless

python chess engines

2016-05-03 Thread DFS
On 5/3/2016 8:00 PM, DFS wrote: How far along are you in your engine development? I can display a text-based chess board on the console (looks better with a mono font). 8 BR BN BB BQ BK BB BN BR 7 BP BP BP BP BP BP BP BP 6 __ __ __ __ __ __ __ __ 5 __ __ __ __ __ __ __ __ 4

Re: How to become more motivated to learn Python

2016-05-03 Thread DFS
On 5/3/2016 10:12 PM, Christopher Reimer wrote: When I realized that I wasn't learning enough about the Python language from translating BASIC games, I started coding a chess engine. If you ever look at the academic literature for chess programming from the last 50+ years, you can spend a lifet

Re: Fastest way to retrieve and write html contents to file

2016-05-03 Thread DFS
On 5/3/2016 11:28 AM, Tim Chase wrote: On 2016-05-03 00:24, DFS wrote: One small comparison I was able to make was VBA vs python/pyodbc to summarize an Access database. Not quite a fair test, but interesting nonetheless. Access 2003 file Access 2003 VBA code Time: 0.18 seconds same Access

Re: Not x.islower() has different output than x.isupper() in list output...

2016-05-03 Thread DFS
On 5/3/2016 10:49 AM, Jussi Piitulainen wrote: DFS writes: On 5/3/2016 9:13 AM, Chris Angelico wrote: It doesn't invert, the way numeric negation does. What do you mean by 'case inverted'? It looks like it swaps the case correctly between upper and lower. There's

Re: Saving Consol outputs in a python script

2016-05-03 Thread DFS
On 5/3/2016 8:14 AM, drewes@gmail.com wrote: Hello, I'm new to python and have a Question. I'm running a c++ file with a python script like: import os import subprocess subprocess.call(["~/caffe/build/examples/cpp_classification/classification", "deploy.prototxt", "this.caffemodel", "mean

Re: Not x.islower() has different output than x.isupper() in list output...

2016-05-03 Thread DFS
On 5/3/2016 9:13 AM, Chris Angelico wrote: On Tue, May 3, 2016 at 11:01 PM, DFS wrote: On 5/3/2016 8:00 AM, Chris Angelico wrote: On Tue, May 3, 2016 at 9:25 PM, Jussi Piitulainen wrote: Chris Angelico writes: This assumes, of course, that there is a function swapcase which can return a

Re: Not x.islower() has different output than x.isupper() in list output...

2016-05-03 Thread DFS
On 5/3/2016 8:00 AM, Chris Angelico wrote: On Tue, May 3, 2016 at 9:25 PM, Jussi Piitulainen wrote: Chris Angelico writes: This assumes, of course, that there is a function swapcase which can return a string with case inverted. I'm not sure such a function exists. str.swapcase("foO")

Re: Fastest way to retrieve and write html contents to file

2016-05-02 Thread DFS
On 5/3/2016 12:06 AM, Michael Torrie wrote: Now if you want to talk about processing the data once you have it, there we can talk about speeds and optimization. Be glad to. Helps me learn python, so bring whatever challenge you want and I'll try to keep up. One small comparison I was able

Re: You gotta love a 2-line python solution

2016-05-02 Thread DFS
On 5/2/2016 11:27 PM, jf...@ms4.hinet.net wrote: DFS at 2016/5/3 9:12:24AM wrote: try from urllib.request import urlretrieve http://stackoverflow.com/questions/21171718/urllib-urlretrieve-file-python-3-3 I'm running python 2.7.11 (32-bit) Alright, it works...someway. I try to get

Re: Fastest way to retrieve and write html contents to file

2016-05-02 Thread DFS
On 5/2/2016 10:00 PM, Chris Angelico wrote: On Tue, May 3, 2016 at 11:51 AM, DFS wrote: On 5/2/2016 3:19 AM, Chris Angelico wrote: There's an easier way to test if there's caching happening. Just crank the iterations up from 10 to 100 and see what happens to the times. If your n

Re: Fastest way to retrieve and write html contents to file

2016-05-02 Thread DFS
On 5/2/2016 3:19 AM, Chris Angelico wrote: There's an easier way to test if there's caching happening. Just crank the iterations up from 10 to 100 and see what happens to the times. If your numbers are perfectly fair, they should be perfectly linear in the iteration count; eg a 1.8 second ten-it

Re: Fastest way to retrieve and write html contents to file

2016-05-02 Thread DFS
On 5/2/2016 4:42 AM, Peter Otten wrote: DFS wrote: Is VB using a local web cache, and Python not? I'm not specifying a local web cache with either (wouldn't know how or where to look). If you have Windows, you can try it. I don't have Windows, but if I

  1   2   >