Fwd: keying by identity in dict and set

2019-10-26 Thread Steve White
Hi Dieter, I'm sure that 99% of all use of 'dict' in Python is exactly this. The vast majority of my own Python code is such, and that is as it should be. Here I have an application where I can do something really cool and useful, by keying on identity. The built-in Python structures are pretty

syntax for ellipsis like as "net.blobs['data'].data[...] = transformed_image"

2019-10-26 Thread xuanwu348
Hi buddies Have a good weekend! I have read some code in caffe, but I confused at "net.blobs['data'].data[...] = transformed_image". The code can be find in this link:https://github.com/BVLC/caffe/blob/master/examples/00-classification.ipynb import caffe model_def = os.path.join(caffe_root, "mo

fileinput

2019-10-26 Thread Pascal
I have a small python (3.7.4) script that should open a log file and display its content but as you can see, an encoding error occurs : --- import fileinput import sys try: source = sys.argv[1:] except IndexError: source = None for line in fileinput.input(source):

Re: Congratulations to @Chris

2019-10-26 Thread Jason Friedman
> > Chris Angelico: [PSF's] 2019 Q2 Community Service Award Winner > http://pyfound.blogspot.com/2019/10/chris-angelico-2019-q2-community.html > > ...and for the many assistances and pearls of wisdom he has contributed > 'here'! > -- > Regards, > =dn > > Agreed. -- https://mail.python.org/mailman/

web scraper

2019-10-26 Thread joseph pareti
Thank you so much for your very valuable guidance on my python experiment. Meanwhile the problems I reported before have been solved. This is part of a program that extracts specific information from bank transaction records, and one functionality I still need to implement is a *web scraper*: The

Re: fileinput

2019-10-26 Thread Peter Otten
Pascal wrote: > I have a small python (3.7.4) script that should open a log file and > display its content but as you can see, an encoding error occurs : > > --- > > import fileinput > import sys > try: > source = sys.argv[1:] > except IndexError: > source = None > fo

Re: web scraper

2019-10-26 Thread Michael Torrie
On 10/25/19 9:19 AM, joseph pareti wrote: > but can it be generalized? > Not all tags are in the form ofto just replace those tags in the code, should > one process a different website? Not really, no. There is not an easy way to generalize this sort of web scraping. There are many different

Re:syntax for ellipsis like as "net.blobs['data'].data[...] = transformed_image"

2019-10-26 Thread xuanwu348
Thanks too, I have find the answer from "https://stackoverflow.com/questions/772124/what-does-the-python-ellipsis-object-do"; This came up in another question recently. I'll elaborate on my answer from there: Ellipsis is an object that can appear in slice notation. For example: myList[1:2, ...

Re: keying by identity in dict and set

2019-10-26 Thread Random832
On Sat, Oct 19, 2019, at 07:31, Steve White wrote: > Hi, > > I have an application that would benefit from object instances > distinguished by identity being used in dict's and set's. To do this, > the __hash__ method must be overridden, the obvious return value being > the instance's id. > > Thi

Re: How to decode UTF strings?

2019-10-26 Thread Eli the Bearded
In comp.lang.python, DFS wrote: > On 10/25/2019 10:57 PM, MRAB wrote: >> Here's a simple example, based in your code: >> >> from email.header import decode_header >> >> def test(header, default_encoding='utf-8'): >> parts = [] >> >> for data, encoding in decode_header(header): >>

pip3 install keyboard did not work in my environment

2019-10-26 Thread tommy yama
Hi, keyboard module can be installed with pip3? Regards, -- https://mail.python.org/mailman/listinfo/python-list