Deutsch   English   Français   Italiano  
<uvltc2$v4b9$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: DFS <nospam@dfs.com>
Newsgroups: comp.os.linux.advocacy
Subject: The Golly! of Python
Date: Tue, 16 Apr 2024 09:10:26 -0400
Organization: A noiseless patient Spider
Lines: 72
Message-ID: <uvltc2$v4b9$1@dont-email.me>
References: <17c636a2d6477a17$13590$197378$802601b3@news.usenetexpress.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 16 Apr 2024 15:10:26 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="2b078b6dcce7c273cb53ebe064aa36bb";
	logging-data="1020265"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+VhuqYFRlkj/N5xt4C7R8/"
User-Agent: Betterbird (Windows)
Cancel-Lock: sha1:hEJ8AospkuRH4brZ4RrlSoOF3FI=
In-Reply-To: <17c636a2d6477a17$13590$197378$802601b3@news.usenetexpress.com>
Content-Language: en-US
Bytes: 2645

On 4/14/2024 1:46 PM, Lameass Larry Piet wrote:

> Who would love python?  Only a fucking asshole.

Eric Raymond says:

"I noticed (allowing for pauses needed to look up new features in 
Programming Python) I was generating working code nearly as fast as I 
could type."

No wonder Gentoo depends so heavily on Python.

Here's a list of some of the files in a directory:

file_999
file_1000
file_998
file_200
file_2000


How about some of your 'extraordinary' C to read the directory and list 
those files in ascending order (because they need to be processed 
sequentially by nbr)?


yeah, crickets, just like I knew


-------------------------------------------------------------
import os
msgdir = "D:\\"
filearr = []
for pfile in os.listdir(msgdir):
	if '_' in pfile:
		filearr.append(int(str(pfile).split('_')[1]))
for filenbr in sorted(filearr):
	print("file_" + str(filenbr))
print()
for filenbr in reversed(sorted(filearr)):
	print("file_" + str(filenbr))
-------------------------------------------------------------
D:\>python temp.py
file_200
file_998
file_999
file_1000
file_2000

file_2000
file_1000
file_999
file_998
file_200
-------------------------------------------------------------

It can also be done in fewer lines with the glob and regex modules, and 
using list comprehension.

By the way, I have a folder of 191K+ such files, and that code runs in:

D:\>python temp.py
0.13s to read 191490 files
First file is 730478
Last file is  943773



Feeb severely pwned by his own ineptitude
C severely owned by python