Re: Correct syntax for pathological re.search()

2024-10-19 Thread jak via Python-list
Peter J. Holzer ha scritto: As a trivial example, the regular expressions r"\\sout{" and r"\\sout\{" are equivalent (the \ before the { is redundant). Yet re.compile(s).pattern preserves the difference between the two strings. Hi, Allow me to be fussy: r"\\sout{" and r"\\sout\{" are similar bu

Re: Python Dialogs

2024-05-06 Thread jak via Python-list
Loris Bennett ha scritto: r...@zedat.fu-berlin.de (Stefan Ram) writes: Me (indented by 2) and the chatbot (flush left). Lines lengths > 72! Is there a name for this kind of indentation, i.e. the stuff you are writing not being flush left? It is sort of contrary to what I think of as "norm

Re: Python Dialogs

2024-05-06 Thread jak via Python-list
Stefan Ram ha scritto: r...@zedat.fu-berlin.de (Stefan Ram) wrote or quoted: translation services are gonna interpret line breaks as I just beefed up my posting program to replace "gonna". Now I won't come across like some street thug, but rather as a respectable member of human soci

Re: UTF_16 question

2024-05-01 Thread jak via Python-list
Richard Damon ha scritto: On Apr 29, 2024, at 12:23 PM, jak via Python-list wrote: Hi everyone, one thing that I do not understand is happening to me: I have some text files with different characteristics, among these there are that they have an UTF_32_le coding, utf_32be, utf_16_le

Re: UTF_16 question

2024-04-29 Thread jak via Python-list
Stefan Ram ha scritto: jak wrote or quoted: I read it, both with encoding='utf_16_be' and with 'utf_16_le' without errors but in the last case the bytes are inverted. I think the order of the octets (bytes) is exactly the difference between

UTF_16 question

2024-04-29 Thread jak via Python-list
Hi everyone, one thing that I do not understand is happening to me: I have some text files with different characteristics, among these there are that they have an UTF_32_le coding, utf_32be, utf_16_le, utf_16_be all of them without BOM. With those utf_32_xx I have no problem but with the UTF_16_xx

Re: help: pandas and 2d table

2024-04-16 Thread jak via Python-list
Stefan Ram ha scritto: jak wrote or quoted: Stefan Ram ha scritto: df = df.where( df == 'zz' ).stack().reset_index() result ={ 'zz': list( zip( df.iloc[ :, 0 ], df.iloc[ :, 1 ]))} Since I don't know Pandas, I will need a month at least to understand these 2 li

Re: help: pandas and 2d table

2024-04-16 Thread jak via Python-list
Stefan Ram ha scritto: df = df.where( df == 'zz' ).stack().reset_index() result ={ 'zz': list( zip( df.iloc[ :, 0 ], df.iloc[ :, 1 ]))} Since I don't know Pandas, I will need a month at least to understand these 2 lines of code. Thanks again. -- https://mail.python.org/mailman/listinfo/python-l

Re: help: pandas and 2d table

2024-04-13 Thread jak via Python-list
Stefan Ram ha scritto: jak wrote or quoted: Would you show me the path, please? I was not able to read xls here, so I used csv instead; Warning: the script will overwrite file "file_20240412201813_tmp_DML.csv"! import pandas as pd with open( 'file_20240412201813_tmp_DM

help: pandas and 2d table

2024-04-12 Thread jak via Python-list
Hi everyone. I state that I don't know anything about 'pandas' but I intuited that it could do what I want. I get, through the "read_excel" method, a table similar to this: obj| foo1 foo2 foo3 foo4 foo5 foo6 --- foo1| aa ab zz ad ae af

Re: on writing a number as 2^s * q, where q is odd

2023-12-05 Thread jak via Python-list
Alan Bawden ha scritto: If you like this sort of stuff, check out the book "Hacker's Delight" by Henry Warren. See. Thank you for your suggestion. Really interesting. Just for fun I tried to port the function to 64 bit: def bit_count_64(n):

Re: on writing a number as 2^s * q, where q is odd

2023-12-04 Thread jak via Python-list
Oscar Benjamin ha scritto: On Sun, 3 Dec 2023 at 10:25, Julieta Shem via Python-list wrote: Alan Bawden writes: def powers_of_2_in(n): bc = (n ^ (n - 1)).bit_count() - 1 return bc, n >> bc That's pretty fancy and likely the fastest. It might be the fastest but it depends how b

Re: on writing a number as 2^s * q, where q is odd

2023-12-03 Thread jak via Python-list
Julieta Shem ha scritto: jak writes: [...] --8<---cut here---start->8--- def powers_of_2_in(n): if remainder(n, 2) != 0: return 0, n else: s, r = powers_of_2_in(n // 2) return 1 + s, r --8<---cut here-

Re: on writing a number as 2^s * q, where q is odd

2023-12-03 Thread jak via Python-list
Julieta Shem ha scritto: Alan Bawden writes: jak writes: Alan Bawden ha scritto: > Julieta Shem writes: > > How would you write this procedure? > def powers_of_2_in(n): > ... > > def powers_of_2_in(n): >

Re: on writing a number as 2^s * q, where q is odd

2023-11-29 Thread jak via Python-list
Dom Grigonis ha scritto: def powers_of_2_in(n): s = 0 while n % 2 == 0: s += 1 n = n // 2 return s, n Good solution, unfortunately if the input data is zero, the function never ends. On 30 Nov 2023, at 02:44, Julieta Shem via Python-list wrote: How would y

Re: on writing a number as 2^s * q, where q is odd

2023-11-29 Thread jak via Python-list
Alan Bawden ha scritto: Julieta Shem writes: How would you write this procedure? def powers_of_2_in(n): ... def powers_of_2_in(n): return (n ^ (n - 1)).bit_count() - 1 Great solution, unfortunately the return value is not a tuple as in the OP version. Maybe in this way?

Re: Code improvement question

2023-11-17 Thread jak via Python-list
MRAB ha scritto: Bare excepts are a very bad idea. I know, you're right but to test the CAS numbers were inside a string (txt) and instead of the 'open(file)' there was 'io.StingIO(txt)' so the risk was almost null. When I copied it here I didn't think about it. Sorry. -- https://mail.python.

Re: Code improvement question

2023-11-17 Thread jak via Python-list
Mike Dewhirst ha scritto: On 15/11/2023 10:25 am, MRAB via Python-list wrote: On 2023-11-14 23:14, Mike Dewhirst via Python-list wrote: I'd like to improve the code below, which works. It feels clunky to me. I need to clean up user-uploaded files the size of which I don't know in advance. Aft

Re: Beep on WIndows 11

2023-11-12 Thread jak via Python-list
Rob Cliffe ha scritto:  Apologies if this is not a Python question. I  recently moved from a WIndows 10 laptop to a Windows 11 one. Although there is nothing wrong with the sound on the new machine (I can listen to podcasts and watch videos), I find that outputting "\a" to the console (aka std

Re: Do subprocess.PIPE and subprocess.STDOUT sametime

2023-05-09 Thread jak
Horst Koiner ha scritto: Hi @all, i'm running a program which is still in development with subprocess.run (Python version 3.10), further i need to capture the output of the program in a python variable. The program itself runs about 2 minutes, but it can also freeze in case of new bugs. For p

Re: What do these '=?utf-8?' sequences mean in python?

2023-05-08 Thread jak
Peter Pearson ha scritto: On Sat, 6 May 2023 14:50:40 +0100, Chris Green wrote: [snip] So, what do those =?utf-8? and ?= sequences mean? Are they part of the string or are they wrapped around the string on output as a way to show that it's utf-8 encoded? Yes, "=?utf-8?" signals "MIME header

Re: Problem with accented characters in mailbox.Maildir()

2023-05-08 Thread jak
Chris Green ha scritto: Chris Green wrote: A bit more information, msg.get("subject", "unknown") does return a string, as follows:- Subject: =?utf-8?Q?aka_Marne_=C3=A0_la_Sa=C3=B4ne_(Waterways_Continental_Europe)?= So it's the 'searchTxt in msg.get("subject", "unknown")' that's failing.

Re: What do these '=?utf-8?' sequences mean in python?

2023-05-08 Thread jak
Chris Green ha scritto: Keith Thompson wrote: Chris Green writes: Chris Green wrote: I'm having a real hard time trying to do anything to a string (?) returned by mailbox.MaildirMessage.get(). What a twit I am :-) Strings are immutable, I have to do:- newstring = oldstring.replace(

Re: Problem with accented characters in mailbox.Maildir()

2023-05-08 Thread jak
Chris Green ha scritto: I have a custom mail filter in python that uses the mailbox package to open a mail message and give me access to the headers. So I have the following code to open each mail message:- # # # Read the message from standard input and make a message object from

Re: How to 'ignore' an error in Python?

2023-04-29 Thread jak
Stefan Ram ha scritto: jak writes: Maybe I only say this because it has happened to me too many times but before ignoring the error in the 'except' branch, I would make sure that if the name exists it is a folder and not a file. If the name exists and it is a file's nam

Re: How to 'ignore' an error in Python?

2023-04-29 Thread jak
Chris Angelico ha scritto: Using mkdirs when you only want to make one is inviting problems of being subtly wrong, where it creates too many levels of directory. Personally, I would just do: Maybe I only say this because it has happened to me too many times but before ignoring the error in the

Re: Incomplete sys.path with embeddable python (Windows)!?

2023-04-24 Thread jak
Ralf M. ha scritto: Am 22.04.2023 um 03:27 schrieb Greg Ewing via Python-list: How are you invoking your script? Presumably you have some code in your embedding application that takes a script path and runs it. Instead of putting the code to update sys.path into every script, the embedding appli

Re: for a 'good python'

2023-04-13 Thread jak
Dennis Lee Bieber ha scritto: On Thu, 13 Apr 2023 00:21:58 +0200, jak declaimed the following: Thank you too. I had seen this library but I always try not to use libraries outside the standard ones. Now I don't remember why I was convinced that this wasn't part of it, perhaps beca

Re: for a 'good python'

2023-04-12 Thread jak
Barry ha scritto:  On 12 Apr 2023, at 18:10, jak wrote: Hi everyone, some time ago I wrote a class to determine if an ipv4 address belonged to a subnet. Seldom using python I'm pretty sure it's not written in 'good python' nor too portable. Could you give me some advi

Re: for a 'good python'

2023-04-12 Thread jak
Stefan Ram ha scritto: jak writes: @property def subnet(self): return self.__to_str(self.__tsubnet) Maybe each of those attributes should be an object of a special class where your "__to_str" is "__str__"? E.g., # code in "calcip.__init__" self.tsubn

for a 'good python'

2023-04-12 Thread jak
Hi everyone, some time ago I wrote a class to determine if an ipv4 address belonged to a subnet. Seldom using python I'm pretty sure it's not written in 'good python' nor too portable. Could you give me some advice to make it better? class calcip: def __init__(self, psubnet: str): ssu

Re: Looking for package/library to extract MP4 metadata

2023-04-10 Thread jak
rbowman ha scritto: On Sun, 9 Apr 2023 09:40:51 +0100, Chris Green wrote: I'm looking for a Python (3) library to access (read only at present) the metadata in MP4 video files, in particular I want to get at dates and times. What's available to do this? Ideally something available in the Ubun

Re: Looking for package/library to extract MP4 metadata

2023-04-10 Thread jak
Chris Green ha scritto: jak wrote: rbowman ha scritto: On Sun, 9 Apr 2023 09:40:51 +0100, Chris Green wrote: I'm looking for a Python (3) library to access (read only at present) the metadata in MP4 video files, in particular I want to get at dates and times. What's available

Re: How to manage python shebang on mixed systems?

2022-11-08 Thread jak
Il 07/11/2022 20:41, Chris Green ha scritto: Schachner, Joseph (US) wrote: Maybe you can't do this, but I would suggest only running on the Python 3 systems. Refuse to jump through hoops for the Python 2 system. It is years out of date. Exactly! That's why I (OP) have only one system where th

Re: How to manage python shebang on mixed systems?

2022-11-06 Thread jak
Il 06/11/2022 11:03, Chris Green ha scritto: I have a number of python scripts that I run on a mix of systems. I have updated them all to run on python 3 but many will also run quite happily with python 2. They all have a #!/usr/bin/python3 shebang. This works almost everywhere but there is on

Re: Find the path of a shell command

2022-10-12 Thread jak
Il 12/10/2022 20:19, MRAB ha scritto: On 2022-10-12 06:11, jak wrote: Il 12/10/2022 06:00, Paulo da Silva ha scritto: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in command

Re: Find the path of a shell command

2022-10-12 Thread jak
Il 12/10/2022 14:20, Chris Green ha scritto: jak wrote: Il 12/10/2022 09:40, jkn ha scritto: On Wednesday, October 12, 2022 at 6:12:23 AM UTC+1, jak wrote: Il 12/10/2022 06:00, Paulo da Silva ha scritto: Hi! The simple question: How do I find the full path of a shell command (linux), i.e

Re: Find the path of a shell command

2022-10-12 Thread jak
Il 12/10/2022 09:40, jkn ha scritto: On Wednesday, October 12, 2022 at 6:12:23 AM UTC+1, jak wrote: Il 12/10/2022 06:00, Paulo da Silva ha scritto: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "ty

Re: Find the path of a shell command

2022-10-12 Thread jak
Il 12/10/2022 06:00, Paulo da Silva ha scritto: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example, "type rm" in command line? The reason: I have python program that launches a detached rm. It works pretty we

Re: open text file

2022-06-24 Thread jak
Il 24/06/2022 15:10, simone zambonardi ha scritto: Good morning, I need to read a text file. How come when I open it (running the script) it says this? The text file is type RFT {\rtf1\ansi\ansicpg1252\cocoartf2636 \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;} {\col

Re: open text file

2022-06-24 Thread jak
Il 24/06/2022 15:44, jak ha scritto: Il 24/06/2022 15:10, simone zambonardi ha scritto: Good morning, I need to read a text file. How come when I open it (running the script) it says this? The text file is type RFT {\rtf1\ansi\ansicpg1252\cocoartf2636 \cocoatextscaling0\cocoaplatform0

Re: "CPython"

2022-06-21 Thread jak
Il 21/06/2022 04:56, Paulo da Silva ha scritto: Às 03:20 de 21/06/22, MRAB escreveu: On 2022-06-21 02:33, Chris Angelico wrote: On Tue, 21 Jun 2022 at 11:13, Paulo da Silva wrote: Às 20:01 de 20/06/22, Paulo da Silva escreveu: > Às 18:19 de 20/06/22, Stefan Ram escreveu: [snip] After all

Re: fill out bulletins

2022-06-14 Thread jak
Il 14/06/2022 15:28, Peter Pearson ha scritto: On Tue, 14 Jun 2022 00:41:07 +0200, jak wrote: [snip] If you are interested in seeing what I called "post office bulletin" (English is not my language and I don't know the name, sorry), you can find a sample pdf (fillable) but it w

Re: fill out bulletins

2022-06-13 Thread jak
Il 13/06/2022 23:58, Mats Wichmann ha scritto: On 6/13/22 11:11, Michael F. Stemper wrote: On 13/06/2022 08.49, jak wrote: Hello everyone, I would like to write a tool to compile post office bulletins because here, unfortunately, they are still the most convenient way to interface the public

Re: fill out bulletins

2022-06-13 Thread jak
Il 13/06/2022 19:11, Michael F. Stemper ha scritto: On 13/06/2022 08.49, jak wrote: Hello everyone, I would like to write a tool to compile post office bulletins because here, unfortunately, they are still the most convenient way to interface the public administration. I don't want to cre

Re: fill out bulletins

2022-06-13 Thread jak
Il 13/06/2022 16:12, Stefan Ram ha scritto: jak writes: Can you direct me to a better way? You could use a word processors with a mail-merge feature or generate TeX/troff code for the bulletins. >Of course, for Python, the library PIL/Pillow is available, which can read or wr

fill out bulletins

2022-06-13 Thread jak
Hello everyone, I would like to write a tool to compile post office bulletins because here, unfortunately, they are still the most convenient way to interface the public administration. I don't want to create a UI to edit the bulletin, I will take the data from some file or database but I'd like t

Re: installing

2022-06-11 Thread jak
Il 10/06/2022 10:51, Yusuf Özdemir ha scritto: ? 000? 3f 63 077 001 -- https://mail.python.org/mailman/listinfo/python-list

Re: usb tv stick and python

2022-05-09 Thread jak
Il 09/05/2022 16:28, Dennis Lee Bieber ha scritto: On Mon, 9 May 2022 08:47:50 +0200, jak declaimed the following: Hello everybody, I usually use vlc to watch tv and I use the w_scan program on linux to create a file (.m3u) with the list of available channels. Unfortunately I can't fi

usb tv stick and python

2022-05-09 Thread jak
Hello everybody, I usually use vlc to watch tv and I use the w_scan program on linux to create a file (.m3u) with the list of available channels. Unfortunately I can't find an alternative to w_scan for Windows and I was wondering if you could tell me some python library that allows me, easily, to

Re: Friday Finking: Contorted loops

2021-09-12 Thread jak
Il 11/09/2021 22:29, Avi Gross ha scritto: Alan and others, I think human languages used to make computer languages will often cause confusion. Some languages have an IF .. ELSE construct but also an EITHER ... OR and a NEITHER ... NOR and other twists and turns like words that sometimes come

Re: Friday Finking: Contorted loops

2021-09-12 Thread jak
-- snip -- An inconsistency that I have been able to notice is this: someone suggests to remedy the absence of the do-while with: while True: ... if condition: break the problem arises if the while has an else of its own because the break not only blocks the while loop but

Re: CPython / Decimal and bit length of value.

2021-09-06 Thread jak
Il 03/09/2021 22:09, Nacnud Nac ha scritto: Hi, Is there a quick way to get the number of bits required to store the value in a Decimal class? What obvious thing am I missing? I'm working with really large integers, say, in the order of 5_000_000 of ASCII base 10 digits. It seems the function m

Re: on floating-point numbers

2021-09-04 Thread jak
Il 03/09/2021 14:45, Chris Angelico ha scritto: I believe the definition of "accurate" here is that, if you take all of the real numbers represented by those floats, add them all together with mathematical accuracy, and then take the nearest representable float, that will be the exact value that

Re: on floating-point numbers

2021-09-03 Thread jak
Il 03/09/2021 09:07, Julio Di Egidio ha scritto: On Friday, 3 September 2021 at 01:22:28 UTC+2, Chris Angelico wrote: On Fri, Sep 3, 2021 at 8:15 AM Dennis Lee Bieber wrote: On Fri, 3 Sep 2021 04:43:02 +1000, Chris Angelico declaimed the following: The naive summation algorithm used by sum(

Re: urgent

2021-08-31 Thread jak
Il 31/08/2021 03:05, Python ha scritto: Hari wrote: i was download ur python software but it is like boring user interface for me like young student to learn ,can u have any updates? God, let me die please... Oh no, please don't speak in that way ... evidently now that python has reached

Re: Decoding of EmailMessage text

2021-08-23 Thread jak
Il 23/08/2021 13:12, Loris Bennett ha scritto: Jon Ribbens writes: On 2021-08-23, Loris Bennett wrote: If instead of mail.set_content(body) I do mail.set_content(body, cte="quoted-printable") Try print(mail.get_content()) rather than print(mail.as_string()) That did the trick -

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-16 Thread jak
Il 13/08/2021 18:17, Chris Angelico ha scritto: On Sat, Aug 14, 2021 at 2:11 AM Terry Reedy wrote: On 8/13/2021 6:53 AM, Umang Goswami wrote: Hi There, Hope you find this mail in good health. I am Umang Goswami, a Python developer and student working on a huge project for automation of music

Re: Ask for help on using re

2021-08-07 Thread jak
Il 07/08/2021 11:18, jak ha scritto: Il 07/08/2021 04:23, Jach Feng ha scritto: jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道: Il 05/08/2021 11:40, Jach Feng ha scritto: I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56

Re: Ask for help on using re

2021-08-07 Thread jak
Il 07/08/2021 04:23, Jach Feng ha scritto: jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道: Il 05/08/2021 11:40, Jach Feng ha scritto: I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compile(r'ch \d{1,}[.]

Re: Ask for help on using re

2021-08-06 Thread jak
Il 06/08/2021 12:57, Jach Feng ha scritto: jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道: Il 05/08/2021 11:40, Jach Feng ha scritto: I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compile(r'ch \d{1,}[.]

Re: Ask for help on using re

2021-08-06 Thread jak
Il 06/08/2021 16:17, jak ha scritto: Il 06/08/2021 12:57, Jach Feng ha scritto: jak 在 2021年8月6日 星期五下午4:10:05 [UTC+8] 的信中寫道: Il 05/08/2021 11:40, Jach Feng ha scritto: I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56

Re: Ask for help on using re

2021-08-06 Thread jak
Il 05/08/2021 11:40, Jach Feng ha scritto: I want to distinguish between numbers with/without a dot attached: text = 'ch 1. is\nch 23. is\nch 4 is\nch 56 is\n' re.compile(r'ch \d{1,}[.]').findall(text) ['ch 1.', 'ch 23.'] re.compile(r'ch \d{1,}[^.]').findall(text) ['ch 23', 'ch 4 ', 'ch 56 '

Re: a clean exit

2021-07-28 Thread jak
Il 23/07/2021 10:55, jak ha scritto: Hello everybody, I wrote a bot for telegram which consists of some processes of which the main ones are: - the main process: a list of callback functions - a second process: managed with a message queue - a third process: started by the library I use (python

a clean exit

2021-07-23 Thread jak
Hello everybody, I wrote a bot for telegram which consists of some processes of which the main ones are: - the main process: a list of callback functions - a second process: managed with a message queue - a third process: started by the library I use (python-telegram-bot) which is used for the eve

packages discoverer

2021-07-17 Thread jak
Sometimes, wandering around the web, I find some example of python code that uses some class or function that I don't know and that I would like to try. I copy the code locally and when I try to run it, I find that the package containing the class/function is not installed on my pc, so I go back t

Re: curses apps on MS Windows?

2021-06-14 Thread jak
Il 13/06/2021 19:44, Grant Edwards ha scritto: There's been a surprising amount of discussion lately about using curses libraries on Windows OS. I'm surprised by this, because I don't think I've ever even seen a Windows curses application. Are there examples of popular curses applications for Wi

Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread jak
Il 31/05/2021 02:36, Dennis Lee Bieber ha scritto: On Mon, 31 May 2021 08:07:21 +1000, Cameron Simpson declaimed the following: Open another terminal, note its terminal device with the "tty" command. Start your programme like this: python .. 2>/dev/tty-of-the-other-termina

Re: string storage [was: Re: imaplib: is this really so unwieldy?]

2021-05-28 Thread jak
Il 27/05/2021 05:54, Cameron Simpson ha scritto: On 26May2021 12:11, Jon Ribbens wrote: On 2021-05-26, Alan Gauld wrote: I confess I had just assumed the unicode strings were stored in native unicode UTF8 format. If you do that then indexing and slicing strings becomes very slow. True, bu

Re: STARTUP FAILURE

2021-05-13 Thread jak
Il 13/05/2021 15:49, Sumukh chakkirala ha scritto: Hello, I have been facing this " startup failure" for a while now, I can open the IDLE from the programs that I have saved but I'm not able to open the IDLE directly. Hope you can help me with this issue as soon as possible. for Windows cmd: C:

Re: port to PDOS (especially mainframe)

2021-04-17 Thread jak
Il 17/04/2021 10:56, Paul Edwards ha scritto: On Saturday, April 17, 2021 at 7:52:07 AM UTC+10, jak wrote: one thing is not clear to me, do you absolutely need to use "asma"? http://www.z390.org/ I forgot to mention that it also requires Java. So instead of porting Python to t

Re: port to PDOS (especially mainframe)

2021-04-16 Thread jak
Il 23/03/2021 10:23, Paul Edwards ha scritto: Hello. I have a new operating system called PDOS which works on both PC and mainframe, which can be found here: http://pdos.sourceforge.net/ I know nothing about Python, my focus is on C90, but I wish to run this mainframe assembler, asma, which was

Re: FileNotFoundError: [Errno 2] No such file or directory: ''

2021-04-14 Thread jak
Il 14/04/2021 18:13, Quentin Bock ha scritto: I receive this error when I try to open a file The file (what I'm trying to open) is in the same folder as the program I'm trying to open it from; why is it saying no such file or directory? this is the only part of the code that causes the error fi

Re: Comparing text strings

2021-04-13 Thread jak
Il 13/04/2021 01:11, Rich Shepard ha scritto: I'm running Slackware64-14.2 and keep a list of installed packages. When a package is upgraded I want to remove the earlier version, and I've not before written a script like this. Could there be a module or tool that already exists to do this? If not

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-04 Thread jak
Il 04/04/2021 18:18, jak ha scritto: Il 04/04/2021 11:13, Chris Angelico ha scritto: On Sun, Apr 4, 2021 at 6:26 PM jak wrote: Il 01/04/2021 01:14, Chris Angelico ha scritto: copy / paste corrupted the tabs, sorry -- https://mail.python.org/mailman/listinfo/python-list

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-04 Thread jak
Il 04/04/2021 11:13, Chris Angelico ha scritto: On Sun, Apr 4, 2021 at 6:26 PM jak wrote: Il 01/04/2021 01:14, Chris Angelico ha scritto: I think this code makes some sort of argument in the debate about whether Python has too much flexibility or if it's the best metaprogramming tools

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-04 Thread jak
Il 01/04/2021 01:14, Chris Angelico ha scritto: I think this code makes some sort of argument in the debate about whether Python has too much flexibility or if it's the best metaprogramming toolset in the world. I'm not sure which side of the debate it falls on, though. class Building: reso

Re: New Python curses book

2021-03-30 Thread jak
Il 30/03/2021 21:05, Brian Oney ha scritto: Congratulations! Indeed, I was wondering for a moment if this was a guide to al dente spaghetti code. With each curse being a funny way to mess with the colleagues performing the code review ;) Indeed, I was wondering for a moment if this was a gui

Re: Compare word to word files

2021-03-11 Thread jak
Il 11/03/2021 16:08, Dennis Lee Bieber ha scritto: On Thu, 11 Mar 2021 08:07:40 +0100, jak declaimed the following: Il 11/03/2021 05:28, CLYMATIC GAMING ha scritto: Hello , I want to compare word to word files please he me! copy and paset this string onto Google page: how to find

Re: Compare word to word files

2021-03-10 Thread jak
Il 11/03/2021 05:28, CLYMATIC GAMING ha scritto: Hello , I want to compare word to word files please he me! copy and paset this string onto Google page: how to find difference between 2 files in Python ...and press "Google Search" button. -- https://mail.python.org/mailman/listinfo/python-lis

Idle Python issue

2021-02-24 Thread jak
Hello everybody, I encounter a problem using Idle Python in Windows when I use utf8 characters longer than 2 bytes such as the character representing the smile emoticon: :-) that is this: 😊 Try to write this in Idle: "😊".encode('utf8') b'\xf0\x9f\x98\x8a' now try to write this: "".encode('utf8'

Re: Is there a way to subtract 3 from every digit of a number?

2021-02-20 Thread jak
Il 20/02/2021 15:40, C W ha scritto: Hello everyone, I'm curious if there is a way take number and back each digit by 3 ? 2342 becomes 9019 8475 becomes 5142 5873 becomes 2540 The tricky part is that 2 becomes 9, not -1. Here's my toy example and what I attempted, test_series = pd.Series(lis

Re: issue with seaborn

2021-02-20 Thread jak
Il 20/02/2021 01:56, Dino ha scritto: trying to do some dayaviz with Italian Covid Open Data ( https://github.com/italia/covid19-opendata-vaccini/ ) here's how I pull my data: import sys import urllib.request import pandas as pd import ssl ssl._create_default_http

Re: list() strange behaviour

2021-01-24 Thread jak
Il 20/12/2020 21:00, danilob ha scritto: Hi, I'm an absolute beginner in Python (and in English too ;-) Running this code: -- # Python 3.9.0 a = [[1, 2, 0, 3, 0], [0, 4, 5, 0, 6], [7, 0, 8, 0, 9], [2, 3, 0, 0, 1], [0, 0, 1, 8, 0]] b = ((x[0] for x in a))

Re: why sqrt is not a built-in function?

2021-01-14 Thread jak
Il 14/01/2021 18:44, Denys Contant ha scritto: I don't understand why sqrt is not a built-in function. Why do we have to first import the function from the math module? I use it ALL THE TIME! That felt good. Thank you. >>> val=16 >>> exp=2 >>> val ** (1/exp) 4.0 >>> -- https://mail.pytho

Re: Control stript which is runing in background.

2021-01-02 Thread jak
PS: difference starts after 64K block -- https://mail.python.org/mailman/listinfo/python-list

Re: Control stript which is runing in background.

2021-01-02 Thread jak
Il 02/01/2021 01:07, Alan Bawden ha scritto: jak writes: Il 01/01/2021 06:23, Alan Bawden ha scritto: > jak writes: > > Running the command: > > $ cat bible.txt > cmdpipe & cat bible.txt > cmdpipe & cat bible.txt > cmdpipe

Re: Control stript which is runing in background.

2021-01-02 Thread jak
Il 02/01/2021 01:07, Alan Bawden ha scritto: jak writes: Il 01/01/2021 06:23, Alan Bawden ha scritto: > jak writes: > > Running the command: > > $ cat bible.txt > cmdpipe & cat bible.txt > cmdpipe & cat bible.txt > cmdpipe

Re: Control stript which is runing in background.

2021-01-01 Thread jak
Il 01/01/2021 14:49, 2qdxy4rzwzuui...@potatochowder.com ha scritto: On 2021-01-01 at 11:11:47 +0100, jak wrote: Il 01/01/2021 04:14, 2qdxy4rzwzuui...@potatochowder.com ha scritto: On 2021-01-01 at 03:43:43 +0100, jak wrote: I think you were clear enough before, but you may not have

Re: Control stript which is runing in background.

2021-01-01 Thread jak
Il 01/01/2021 04:14, 2qdxy4rzwzuui...@potatochowder.com ha scritto: On 2021-01-01 at 03:43:43 +0100, Regarding "Re: Control stript which is runing in background.," jak wrote: Il 01/01/2021 01:43, Cameron Simpson ha scritto: On 01Jan2021 01:21, jak wrote: Il 01/01/2021 00:58, 2qd

Re: Control stript which is runing in background.

2021-01-01 Thread jak
Il 01/01/2021 06:23, Alan Bawden ha scritto: jak writes: Running the command: $ cat bible.txt > cmdpipe & cat bible.txt > cmdpipe & cat bible.txt > cmdpipe the three texts do not mix The three texts do not mix as long at the contents of bible.txt is

Re: Control stript which is runing in background.

2020-12-31 Thread jak
Il 01/01/2021 01:43, Cameron Simpson ha scritto: On 01Jan2021 01:21, jak wrote: Il 01/01/2021 00:58, 2qdxy4rzwzuui...@potatochowder.com ha scritto: Most of the time, I have several shells open, often with their own background jobs running. Limiting write permission on the pipe to &qu

Re: Control stript which is runing in background.

2020-12-31 Thread jak
Il 01/01/2021 00:58, 2qdxy4rzwzuui...@potatochowder.com ha scritto: Most of the time, I have several shells open, often with their own background jobs running. Limiting write permission on the pipe to "me" wouldn't prevent concurrent access. This is true but there would be no difference if thi

Re: Control stript which is runing in background.

2020-12-31 Thread jak
... but this won't be the problem the OP may encounter if its intention is to create a script to command another one that is running. It will be sufficient to limit the write permissions to the pipe file to himself ... perhaps protecting the pipe file inside a directory with stickibits set. --

Re: Control stript which is runing in background.

2020-12-31 Thread jak
Il 31/12/2020 22:43, Cameron Simpson ha scritto: On 31Dec2020 18:07, jak wrote: Il 31/12/2020 11:43, Petro ha scritto: I would like to make something like this: A python script would run headlessly in the background. I would like to control the script from the command line using other python

Re: Control stript which is runing in background.

2020-12-31 Thread jak
Il 31/12/2020 11:43, Petro ha scritto: Hi. I would like to make something like this: A python script would run headlessly in the background. I would like to control the script from the command line using other python scripts or from the python shell. From time to time I would ask the main scrip

Re: Which method to check if string index is queal to character.

2020-12-29 Thread jak
Il 29/12/2020 02:48, Bischoop ha scritto: On 2020-12-28, Mats Wichmann wrote: On 12/28/20 10:46 AM, Marco Sulla wrote: On Mon, 28 Dec 2020 at 17:37, Bischoop wrote: I'd like to check if there's "@" in a string and wondering if any method is better/safer than others. I was told on one occasi

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

2020-12-17 Thread jak
Il 17/12/2020 13:33, Chris Angelico ha scritto: On Thu, Dec 17, 2020 at 11:16 PM jak wrote: Il 17/12/2020 12:40, Peter J. Holzer ha scritto: On 2020-12-17 12:16:29 +0100, jak wrote: print(_ if d.get('a', None) is not None else get_default()) That doesn't work: print(_ if

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

2020-12-17 Thread jak
Il 17/12/2020 12:40, Peter J. Holzer ha scritto: On 2020-12-17 12:16:29 +0100, jak wrote: print(_ if d.get('a', None) is not None else get_default()) That doesn't work: print(_ if d.get('a', None) is not None else get_default()) Traceback (most recent call last

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

2020-12-17 Thread jak
Il 17/12/2020 12:40, Peter J. Holzer ha scritto: On 2020-12-17 12:16:29 +0100, jak wrote: print(_ if d.get('a', None) is not None else get_default()) That doesn't work: print(_ if d.get('a', None) is not None else get_default()) Traceback (most recent call last

  1   2   >