Re: Spread a statement over various lines

2019-09-17 Thread Peter Otten
Manfred Lotz wrote: > I have a function like follows > > def regex_from_filepat(fpat): > rfpat = fpat.replace('.', '\\.') \ > .replace('%', '.') \ > .replace('*', '.*') > > return '^' + rfpat + '$' > > > As I don't want to have the replace()

Re: Obtain the file's path.

2019-09-17 Thread Cameron Simpson
On 17Sep2019 15:09, Hongyi Zhao wrote: See the following two methods for obtaining the file's path: os.path.realpath(file) or os.path.abspath(os.path.expanduser(file)) Which is more robust? They're probably equally robust (BTW, you need the expanduser in the realpath call as well, if your f

Re: Spread a statement over various lines

2019-09-17 Thread Manfred Lotz
On Tue, 17 Sep 2019 16:51:04 -0400 Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: > On 9/17/19 2:59 PM, Manfred Lotz wrote: > > > def regex_from_filepat(fpat): > > rfpat = fpat.replace('.', '\\.') \ > >.replace('%', '.') \ > >.rep

Re: python3 subprocess run sudo cmd in remote failed

2019-09-17 Thread Eli the Bearded
In comp.lang.python, lampahome wrote: > what I tried many times like enter password, but it failed. > I just want to use ps.stdin.write(password) to send password, but it always > jump password prompt immediately. Passwords are frequently read from stderr, not stdin, so that tools can get a huma

Re: Unicode UCS2, UCS4 and ... UCS1

2019-09-17 Thread Chris Angelico
On Wed, Sep 18, 2019 at 6:51 AM Eli the Bearded <*@eli.users.panix.com> wrote: > > In comp.lang.python, moi wrote: > > I hope, one day, for those who are interested in Unicode, > > they find a book, publication, ... which will explain > > what is UCS1. > > There isn't anything called UCS1. There

Re: Spread a statement over various lines

2019-09-17 Thread Dan Sommers
On 9/17/19 2:59 PM, Manfred Lotz wrote: > def regex_from_filepat(fpat): > rfpat = fpat.replace('.', '\\.') \ >.replace('%', '.') \ >.replace('*', '.*') > > return '^' + rfpat + '$' > > As I don't want to have the replace() functions in on

Re: Unicode UCS2, UCS4 and ... UCS1

2019-09-17 Thread Eli the Bearded
In comp.lang.python, moi wrote: > I hope, one day, for those who are interested in Unicode, > they find a book, publication, ... which will explain > what is UCS1. There isn't anything called UCS1. There is a UTF-1, but don't use it. UTF-8 is better in every way. https://en.wikipedia.org/wiki/U

Re: How do I purge pip intsall --user packages?

2019-09-17 Thread Manfred Lotz
On 17 Sep 2019 19:10:29 GMT Martin Schöön wrote: > I have installed a bunch of packages using pip install --user and > I went for a non-standard location for the install. Now I regret > this and would like to wipe this and start all over again using > the standard location. Is it enough to delete

Re: Spread a statement over various lines

2019-09-17 Thread Manfred Lotz
On Tue, 17 Sep 2019 20:59:47 +0200 Manfred Lotz wrote: > I have a function like follows > > def regex_from_filepat(fpat): > rfpat = fpat.replace('.', '\\.') \ > .replace('%', '.') \ Not related to my question but the second replace must be: .replace(

How do I purge pip intsall --user packages?

2019-09-17 Thread Martin Schöön
I have installed a bunch of packages using pip install --user and I went for a non-standard location for the install. Now I regret this and would like to wipe this and start all over again using the standard location. Is it enough to delete the folder I specified or am I missing something? Having t

Spread a statement over various lines

2019-09-17 Thread Manfred Lotz
I have a function like follows def regex_from_filepat(fpat): rfpat = fpat.replace('.', '\\.') \ .replace('%', '.') \ .replace('*', '.*') return '^' + rfpat + '$' As I don't want to have the replace() functions in one line my question is if it

Re: Python3.7 singleton is not unique anymore

2019-09-17 Thread Eko palypse
Shame on me :-) Thank you very much Ethan. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python3.7 singleton is not unique anymore

2019-09-17 Thread Ethan Furman
On 09/17/2019 09:45 AM, Eko palypse wrote: else: class FOO(): def __init__(self, metaclass=Singleton): In your test code, the `metaclass=Singleton` should be in `class Foo`: class FOO(metaclass=Singleton): ... -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/p

Python3.7 singleton is not unique anymore

2019-09-17 Thread Eko palypse
Using the following code in Python3.7 doesn't make FOO to be singleton anymore. import sys class Singleton(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)

Obtain the file's path.

2019-09-17 Thread Hongyi Zhao
See the following two methods for obtaining the file's path: os.path.realpath(file) or os.path.abspath(os.path.expanduser(file)) Which is more robust? -- https://mail.python.org/mailman/listinfo/python-list

Re: Irritating bytearray behavior

2019-09-17 Thread Grant Edwards
On 2019-09-17, Ian Pilcher wrote: > I am using a bytearray to construct a very simple message, that will be > sent across the network. The message should always be 20 bytes: > >2 bytes - address family (AF_INET or AF_INET6) - network byte order >2 bytes - (padding) >4 or 16 bytes - IP

Re: not working

2019-09-17 Thread Piet van Oostrum
r...@zedat.fu-berlin.de (Stefan Ram) writes: > Supersedes: > > MRAB writes: >> >>> import re >> >>> pattern = r'[0-9]{4,6}' >> >>> pattern2 = r'[0-9][0-9][0-9][0-9]([0-9]){0,2}' >> >>> re.search(pattern, '1234') >> >> >>> re.search(pattern2, '1234') >> >>They look the same to me. > > |>>> import

Re: Using a usb to boot and install the Debian os on my harddisk.

2019-09-17 Thread nospam_2019
Am 17.09.19 um 12:41 schrieb Hongyi Zhao: > Hi, > > Is some python tools to make a bootable usb and then using it to install > the following dvd-iso into my harddisk: > > https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/debian-10.1.0- > amd64-DVD-1.iso No python tool needed, just copy

Using a usb to boot and install the Debian os on my harddisk.

2019-09-17 Thread Hongyi Zhao
Hi, Is some python tools to make a bootable usb and then using it to install the following dvd-iso into my harddisk: https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/debian-10.1.0- amd64-DVD-1.iso Regards -- https://mail.python.org/mailman/listinfo/python-list

Re: Something faster than turtle

2019-09-17 Thread Tintin
Thank you very much Stefan, I'll have a look at it. Le 17/09/2019 à 01:37, Stefan Ram a écrit : tracer( 0 )/update() -- https://mail.python.org/mailman/listinfo/python-list