Re: How to combine a group of lists together

2019-12-20 Thread wanghao7915
Thanks! Actually, I neglected that my "print" is in the "for", so I get a group of lists. Now I put the "print" out of the iteration then use .extend to append each list I produce. Finally, print and get my ideal result. Haha, I'm too naive, so is my English. -- https://mail.python.org/mailman/

Re: How to combine a group of lists together

2019-12-20 Thread wanghao7915
thanks for responding! Now I've solved this problem! My former code is: for j in data: spe = j.get_text() l_spe = spe.split() print(l_spe) Then I get the result: ['$278.86as', 'of', 'Dec', '20,', '2019,', '06:47', 'PST', '-', 'Details'] ['4.7', 'inches'] ['750', 'x', '1334'] [

Re: How to extend an object?

2019-12-20 Thread DL Neil via Python-list
On 21/12/19 2:50 pm, Greg Ewing wrote: On 21/12/19 1:59 am, Stefan Ram wrote:    I would like to add a method to a string.    This is not possible in Python? It's not possible. Built-in classes can't have methods added to them. You can define your own subclass of str and give it whatever met

Re: How to combine a group of lists together

2019-12-20 Thread DL Neil via Python-list
On 21/12/19 6:04 pm, wanghao7...@gmail.com wrote: I utilized .get_text() + .split() functions and obtain this: spe= ['$278.86as', 'of', 'Dec', '20,', '2019,', '06:47', 'PST', '-', 'Details'] ['4.7', 'inches'] ['750', 'x', '1334'] ['64', 'GB'] ['2', 'GB'] ['Apple', 'A11', 'Bionic,', 'Hexa-Core,',

Re: How to combine a group of lists together

2019-12-20 Thread Cameron Simpson
On 20Dec2019 21:04, wanghao7...@gmail.com wrote: I utilized .get_text() + .split() functions and obtain this: spe= ['$278.86as', 'of', 'Dec', '20,', '2019,', '06:47', 'PST', '-', 'Details'] ['4.7', 'inches'] ['750', 'x', '1334'] ['64', 'GB'] ['2', 'GB'] ['Apple', 'A11', 'Bionic,', 'Hexa-Core,',

How to combine a group of lists together

2019-12-20 Thread wanghao7915
I utilized .get_text() + .split() functions and obtain this: spe= ['$278.86as', 'of', 'Dec', '20,', '2019,', '06:47', 'PST', '-', 'Details'] ['4.7', 'inches'] ['750', 'x', '1334'] ['64', 'GB'] ['2', 'GB'] ['Apple', 'A11', 'Bionic,', 'Hexa-Core,', '(2x', 'Monsoon', '+', '4x', 'Mistral)'] ['5.22', '

Re: How to extend an object?

2019-12-20 Thread Greg Ewing
On 21/12/19 1:59 am, Stefan Ram wrote: I would like to add a method to a string. This is not possible in Python? It's not possible. Built-in classes can't have methods added to them. You can define your own subclass of str and give it whatever methods you want. But in your case: for

Re: Unable to install "collect" via pip3

2019-12-20 Thread Barry
> On 20 Dec 2019, at 15:27, Mahmood Naderan via Python-list > wrote: > > Hi > > I can install collect with pip for python2.7 > $ pip install --user collect > Collecting collect > Using cached > https://files.pythonhosted.org/packages/cf/5e/c0f0f51d0

Re: Unable to install "collect" via pip3

2019-12-20 Thread Terry Reedy
On 12/20/2019 2:22 AM, Mahmood Naderan via Python-list wrote: However, pip3 fails with this error $ pip3 install --user collect Collecting collect Using cached https://files.pythonhosted.org/packages/cf/5e/c0f0f51d081665374a2c219ea4ba23fb1e179b70dded96dc16606786d828/collect-0.1.1.tar.gz Coll

Re: Problems with "Tarfile.close()"

2019-12-20 Thread Chris Angelico
On Sat, Dec 21, 2019 at 6:13 AM Peter Otten <__pete...@web.de> wrote: > > Dr Rainer Woitok wrote: > > > Ethan, > > > > On Friday, 2019-12-20 07:41:51 -0800, you wrote: > > > >> ... > >> In Python 3 `sys.stdout` is a character interface, not bytes. > > > > Does that mean that with Python 3 "Tarfile

Re: on sorting things

2019-12-20 Thread Chris Angelico
On Sat, Dec 21, 2019 at 6:01 AM Peter Otten <__pete...@web.de> wrote: > > Chris Angelico wrote: > > > On Sat, Dec 21, 2019 at 5:03 AM Peter Otten <__pete...@web.de> wrote: > >> PS: If you are sorting files by size and checksum as part of a > >> deduplication effort consider using dict-s instead: >

Re: Problems with "Tarfile.close()"

2019-12-20 Thread Peter Otten
Dr Rainer Woitok wrote: > Ethan, > > On Friday, 2019-12-20 07:41:51 -0800, you wrote: > >> ... >> In Python 3 `sys.stdout` is a character interface, not bytes. > > Does that mean that with Python 3 "Tarfile" is no longer able to write > the "tar" file to a pipe? Or is there now another wa

Re: on sorting things

2019-12-20 Thread Peter Otten
Chris Angelico wrote: > On Sat, Dec 21, 2019 at 5:03 AM Peter Otten <__pete...@web.de> wrote: >> PS: If you are sorting files by size and checksum as part of a >> deduplication effort consider using dict-s instead: > > Yeah, I'd agree if that's the purpose. But let's say the point is to > have a

Re: Cython, producing different modules from the same .pyx

2019-12-20 Thread Lele Gaifax
Ethan Furman writes: > If you don't get an answer here, you can try the Cython Users group: Thanks, reposted the same question there. ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapens

Re: Cython, producing different modules from the same .pyx

2019-12-20 Thread Lele Gaifax
Greg Ewing writes: > You could try creating a set of top-level .pyx stubs, each of > which just 'include' the real code. Thank you, will try this approach! ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi m

Re: on sorting things

2019-12-20 Thread Chris Angelico
On Sat, Dec 21, 2019 at 5:03 AM Peter Otten <__pete...@web.de> wrote: > PS: If you are sorting files by size and checksum as part of a deduplication > effort consider using dict-s instead: Yeah, I'd agree if that's the purpose. But let's say the point is to have a guaranteed-stable ordering of fil

Re: on sorting things

2019-12-20 Thread Peter Otten
Eli the Bearded wrote: > In comp.lang.python, Peter Otten <__pete...@web.de> wrote: >> Eli the Bearded wrote: >>> But what caught my eye most, as someone relatively new to Python but >>> with long experience in C in Perl, is sorting doesn't take a > > s/C in /C and/ > > Ugh. > >>> *comparison*

Re: Problems with "Tarfile.close()"

2019-12-20 Thread Dr Rainer Woitok
Ethan, On Friday, 2019-12-20 07:41:51 -0800, you wrote: > ... > In Python 3 `sys.stdout` is a character interface, not bytes. Does that mean that with Python 3 "Tarfile" is no longer able to write the "tar" file to a pipe? Or is there now another way to write to a pipe? And if that new

Re: [HN] How to Make Python Wait

2019-12-20 Thread p4j
>> https://news.ycombinator.com/item?id=21834408 > Did you just post a blog article, then spam everywhere to try to get > traffic, where your entire blog post is telling people worse ways to > do a time.sleep()? Blog post is not mine. I have a habit of posting good things to HN. When I got notific

Re: How to improve epoll speed when recv from kernel via netlink?

2019-12-20 Thread Barry Scott
> On 20 Dec 2019, at 04:33, lampahome wrote: > > I tried to receive msg from kernel via netlink of socket. > > And I use epoll to receive netlink events whenever it comes from kernel to > user space. > > But I found the performance is poor e.g. epoll costs 90% time of execution > time after

Re: Problems with "Tarfile.close()"

2019-12-20 Thread Ethan Furman
On 12/20/2019 04:19 AM, Dr Rainer Woitok wrote: One of my Python scripts basically does the following: source = tarfile.open(name=tar_archive , mode='r|*') dest = tarfile.open(fileobj=sys.stdout, mode='w|', format=fmt) . . . source.close() dest.close() In an attempt to move my Pytho

Re: Problems with "Tarfile.close()"

2019-12-20 Thread Chris Angelico
On Sat, Dec 21, 2019 at 2:29 AM Dr Rainer Woitok wrote: > > Greetings, > > One of my Python scripts basically does the following: > > source = tarfile.open(name=tar_archive , mode='r|*') > dest = tarfile.open(fileobj=sys.stdout, mode='w|', format=fmt) > > . > . > . > > source.close() > dest.

Re: Unable to install "collect" via pip3

2019-12-20 Thread Chris Angelico
On Sat, Dec 21, 2019 at 2:25 AM Mahmood Naderan via Python-list wrote: > > Hi > > I can install collect with pip for python2.7 > $ pip install --user collect > However, pip3 fails with this error > $ pip3 install --user collect > NameError: name 'file' is not defined > > I can not figure out

Problems with "Tarfile.close()"

2019-12-20 Thread Dr Rainer Woitok
Greetings, One of my Python scripts basically does the following: source = tarfile.open(name=tar_archive , mode='r|*') dest = tarfile.open(fileobj=sys.stdout, mode='w|', format=fmt) . . . source.close() dest.close() In an attempt to move my Python scripts from Python 2.7 to Python 3.6 I

Unable to install "collect" via pip3

2019-12-20 Thread Mahmood Naderan via Python-list
Hi I can install collect with pip for python2.7 $ pip install --user collect Collecting collect Using cached https://files.pythonhosted.org/packages/cf/5e/c0f0f51d081665374a2c219ea4ba23fb1e179b70dded96dc16606786d828/collect-0.1.1.tar.gz Collecting couc

Re: [HN] How to Make Python Wait

2019-12-20 Thread Abdur-Rahmaan Janhangeer
Original from miguel grinberg -- https://mail.python.org/mailman/listinfo/python-list

Re: [HN] How to Make Python Wait

2019-12-20 Thread Chris Angelico
On Fri, Dec 20, 2019 at 11:16 PM Pankaj Jangid wrote: > > https://news.ycombinator.com/item?id=21834408 > > Did you just post a blog article, then spam everywhere to try to get traffic, where your entire blog post is telling people worse ways to do a time.sleep()? ChrisA -- https://mail.python.

[HN] How to Make Python Wait

2019-12-20 Thread Pankaj Jangid
https://news.ycombinator.com/item?id=21834408 -- https://mail.python.org/mailman/listinfo/python-list