Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: How to read in mulitple files efficiently
Post: RE: How to read in mulitple files efficiently
Maybe fileinput is something for you.
https://docs.python.org/3/library/fileinput.html
import fileinput
from pathlib import Path
# example text files
files = list(Path().glob("*.txt"))
with fileinp... |
|
DeaD_EyE |
General Coding Help |
1 |
111 |
Yesterday, 11:47 AM |
|
|
Thread: Finding the median of a column in a huge CSV file
Post: RE: Finding the median of a column in a huge CSV f...
import csv
from operator import itemgetter
def get_avg(file, column, data_type, skip_header):
getter = itemgetter(column)
total = 0
count = 0
with open(file, encoding=... |
|
DeaD_EyE |
Data Science |
5 |
148 |
Jan-24-2023, 04:22 PM |
|
|
Thread: Python [nogil]
Post: RE: Python [nogil]
import time
from threading import Thread
ACTIVE = True
def spinner():
while ACTIVE:
pass
def main(threads):
print("Starting 16 CPU bound Threads")
for thread in threads:
... |
|
DeaD_EyE |
News and Discussions |
3 |
164 |
Jan-24-2023, 09:29 AM |
|
|
Thread: Python [nogil]
Post: Python [nogil]
Today I found this: https://github.com/colesbury/nogil
Quote:Overview
This is a proof-of-concept implementation of CPython that supports multithreading without the global interpreter lock (GIL). An ... |
|
DeaD_EyE |
News and Discussions |
3 |
164 |
Jan-23-2023, 08:51 PM |
|
|
Thread: launching executables
Post: RE: launching executables
Example (Linux only) to check a lock.pid.
import atexit
import os
import time
from pathlib import Path
def run_check():
"""
Read the lock.pid (next to __file__) if exists
and check if a... |
|
DeaD_EyE |
General Coding Help |
6 |
377 |
Jan-15-2023, 02:45 PM |
|
|
Thread: Adding values with reduce() function from the list of tuples
Post: RE: Adding values with reduce() function from the ...
Firstly, the name of the list should not be named list because list is a built-in function.
To get the second values from the tuple, you must iterate over the data.
data = [
("Rachel", 19),
("... |
|
DeaD_EyE |
General Coding Help |
10 |
558 |
Jan-05-2023, 12:43 PM |
|
|
Thread: Method works as expected on host machine but not on server
Post: RE: Method works as expected on host machine but n...
(Jan-04-2023, 03:44 PM)gradlon93 Wrote: Description of the error: when updating current_color from within the while loop, I forgot to PARSE again the .ini file, so it didn't update but stayed always... |
|
DeaD_EyE |
General Coding Help |
4 |
343 |
Jan-05-2023, 10:41 AM |
|
|
Thread: Advice on develop an offline audio transcription software with no knowledge
Post: RE: Advice on develop an offline audio transcripti...
You should try this project: https://github.com/openai/whisper
I've used it to transcribe some Videos, and it worked well with German.
It works even better with english. It is also possible, that you ... |
|
DeaD_EyE |
Homework |
3 |
290 |
Jan-05-2023, 09:35 AM |
|
|
Thread: Sections of the code causes the GUI to freeze. What should I do?
Post: RE: Stuck in function
if pyautogui.locateCenterOnScreen("loot_icon.png", confidence = 0.9):
...pyautogui.locateCenterOnScreen could return None or a tuple with two int.
The if statement asks the object for its boolean... |
|
DeaD_EyE |
GUI |
13 |
833 |
Jan-04-2023, 12:56 PM |
|
|
Thread: Method works as expected on host machine but not on server
Post: RE: Method works as expected on host machine but n...
Look if 'traffic_light.ini' are locally and on the server are identical. |
|
DeaD_EyE |
General Coding Help |
4 |
343 |
Jan-04-2023, 12:44 PM |
|
|
Thread: List joining
Post: RE: List joining
(Dec-05-2022, 07:50 PM)deatz Wrote: Example
Task list: a, b, c
People list: John, Joe, Karen, Billy, Bob, Lisa, Derek
Desired Output: a: John, Billy, Derek
b: Joe, Bob
c: Karen, Lisa
Is this True?... |
|
DeaD_EyE |
Homework |
14 |
1,112 |
Dec-15-2022, 04:49 PM |
|
|
Thread: Python for frontend !
Post: RE: Python for frontend !
|
DeaD_EyE |
News and Discussions |
8 |
616 |
Dec-09-2022, 11:16 AM |
|
|
Thread: Prompt of Access ( Authentication Http ) ?
Post: RE: Prompt of Access ( Authentication Http ) ?
|
DeaD_EyE |
Networking |
4 |
308 |
Dec-08-2022, 12:42 PM |
|
|
Thread: Prompt of Access ( Authentication Http ) ?
Post: RE: Prompt of Access ( Authentication Http ) ?
The colon at the end of WWW-Authenticate is wrong.
But you also require handling:Not Authorized
Authorized
Incorrect authorization
Code to handle this:
from base64 import b64decode
from hashlib i... |
|
DeaD_EyE |
Networking |
4 |
308 |
Dec-08-2022, 12:41 PM |
|
|
Thread: merge two csv files into output.csv using Subprocess
Post: RE: merge two csv files into output.csv using Subp...
(Dec-07-2022, 11:01 PM)Pedroski55 Wrote: TypeError: unsupported operand type(s) for |: 'type' and 'type'
This is not your fault. It comes from the fancy annotations (Union: |), which are not support... |
|
DeaD_EyE |
General Coding Help |
9 |
526 |
Dec-08-2022, 10:12 AM |
|
|
Thread: Setting For Loop Counter
Post: RE: Setting For Loop Counter
I do not understand your question. Do you want to have a list with 4 valid team names?
If it's the case, the range won't help.
Maybe this is what you want:
# plural
teams = ["Arsenal", "Liverpool", "... |
|
DeaD_EyE |
General Coding Help |
2 |
167 |
Dec-07-2022, 12:49 PM |
|
|
Thread: merge two csv files into output.csv using Subprocess
Post: RE: merge two csv files into output.csv using Subp...
Use Python instead of depending on OS infrastructure. This program could not run on Linux/Mac for example.
Here an example function to merge files:
from pathlib import Path
def merge_files(input_fil... |
|
DeaD_EyE |
General Coding Help |
9 |
526 |
Dec-07-2022, 09:53 AM |
|
|
Thread: How I could do that in the best way?
Post: RE: How I could do that in the best way?
This is just checking how many parts the path has. The first part is always /.
from pathlib import Path
from urllib.parse import urlparse
def how_many(url):
return len(Path(urlparse(url).path).p... |
|
DeaD_EyE |
General Coding Help |
5 |
291 |
Dec-06-2022, 03:35 PM |
|
|
Thread: using paramiko to see resualt
Post: RE: using pexpect on windows
Answer to wrong topic or the op has changed something?
I don't know what happened :-D
The answer is related to: How to get the IP-Address from Windows.
The easiest approach to obtain the IP-Addres... |
|
DeaD_EyE |
General Coding Help |
4 |
238 |
Dec-06-2022, 10:25 AM |
|
|
Thread: Printing a raw string with a folder separator at the end, duplicates the separator
Post: RE: Printing a raw string with a folder separator ...
You can use forward-slashes and Pathlib:
import os
from pathlib import Path
p = Path("C:/Temp")
# the leading / or \\ is not required
print(p.drive)
print(p.name)
print(p.parts)
print("p.is_dir():... |
|
DeaD_EyE |
General Coding Help |
5 |
335 |
Nov-28-2022, 11:57 AM |