Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Splitting Manhua & Manhwa
Post: RE: Splitting Manhua & Manhwa
Here another approach using Pillow and NumPy.
from PIL import Image
import numpy as np
image_path = "img.png"
img = Image.open(image_path)
# Convert the image to RGB for processing
img_np = np.array(... |
|
snippsat |
General Coding Help |
6 |
356 |
Yesterday, 01:58 PM |
|
|
Thread: Strange Code
Post: RE: Strange Code
ser_bytes[0:len(ser_bytes)-2] part is Python's slicing mechanism for lists, strings, or byte-like objects.
To give a example,code look like reading from a serial connection
>>> ser_bytes = b'... |
|
snippsat |
General Coding Help |
2 |
136 |
Yesterday, 05:29 AM |
|
|
Thread: Python directory structure in wqin 11
Post: RE: Python directory structure in wqin 11
Some info on how this work.
Environment Variables Path do changes here to Python 3.12 path.
As shown in this image image
You add this.
Output:C:/users/hamil/appdata/l;ocal/programs/python312
C:/users... |
|
snippsat |
General Coding Help |
2 |
143 |
Sep-06-2024, 01:52 PM |
|
|
Thread: [SOLVED] [BeautifulSoup] Why are some elements ignored?
Post: RE: [BeautifulSoup] Why are some elements ignored?
(Sep-03-2024, 11:29 AM)Winfried Wrote: How to can I grab both footnotes that contain OR do not contain sub-elements — italics; I guess there are not other possible sub-elements within?That should be... |
|
snippsat |
General Coding Help |
5 |
309 |
Sep-03-2024, 02:15 PM |
|
|
Thread: [SOLVED] [BeautifulSoup] Why are some elements ignored?
Post: RE: [BeautifulSoup] Why are some elements ignored?
See if this helps.
Look at CSS Selectors that what i use here,
it's powerful and many forget that BS has support for this.
from bs4 import BeautifulSoup
html = """\
<div id="page14"><p>18... |
|
snippsat |
General Coding Help |
5 |
309 |
Sep-02-2024, 07:10 PM |
|
|
Thread: Web scraping from bar chart in image format with Python
Post: RE: Web scraping from bar chart in image format wi...
You should try to find the data source so don't have to parse for a finish graph image.
Can be a interesting problem to get data from a image,so as a test i use pytesseract, Pillow.
tesseract from com... |
|
snippsat |
Web Scraping & Web Development |
3 |
411 |
Sep-02-2024, 03:25 PM |
|
|
Thread: Graphing a list of ranges
Post: RE: Graphing a list of ranges
Example with plotly
So this dos most,also example of "Clicking the range should trigger an action" which now grey out other ranges.
import plotly.graph_objects as go
# Define the start and end of th... |
|
snippsat |
Web Scraping & Web Development |
2 |
236 |
Sep-01-2024, 12:32 PM |
|
|
Thread: file sharing across devices question
Post: RE: file sharing across devices question
A online database eg Turso great free offer of 500 Databases, 9GB storage.
Eg convert the csv file to sqlite.
import pandas as pd
import sqlite3
conn = sqlite3.connect('reminders.db')
df = pd.read_cs... |
|
snippsat |
General Coding Help |
3 |
357 |
Aug-31-2024, 06:30 PM |
|
|
Thread: Help with generating regx Pattern please
Post: RE: Help with generating regx Pattern please
import re
text = '''\
˜16524:˜ 1 §š£™££LÁ-SÔÙÌE£™£š£¥
˜11241:˜ 159 —.M˜A›CX.
˜11243:˜ 90 š™ÄŸIšDI
˜11245:˜ 89 BITSHAKER
˜11247:˜ 20 °À³™È›OŸLY˜ œÍO˜SEŸS›«™ÀÀ®’
˜11248:˜ 11 EAGLEWIN... |
|
snippsat |
Data Science |
3 |
348 |
Aug-28-2024, 06:55 PM |
|
|
Thread: creating arbitrary local variable names
Post: RE: creating arbitrary local variable names
(Aug-25-2024, 11:02 PM)Skaperen Wrote: i have some code that creates a bunch of variable names with their intended valuesAs mention use a data structure,when make a variables Python will store it in... |
|
snippsat |
General Coding Help |
9 |
559 |
Aug-27-2024, 03:19 PM |
|
|
Thread: JSON File - extract only the data in a nested array for CSV file
Post: RE: JSON File - extract only the data in a nested ...
Something like this should work.
import csv
import json
def json_to_csv(json_file, csv_file):
with open(json_file) as f:
data = json.load(f)
f = csv.writer(open(csv_file, "w+", ne... |
|
snippsat |
General Coding Help |
2 |
250 |
Aug-26-2024, 08:13 PM |
|
|
Thread: Help Converting .py to .exe
Post: RE: Help Converting .py to .exe
(Aug-26-2024, 05:36 PM)MrLegend11 Wrote: However, when console=False is set in the .spec file, the console does not appear, and the script doesn't run as expected when I execute the .exe.Look at --h... |
|
snippsat |
General Coding Help |
9 |
1,210 |
Aug-26-2024, 05:59 PM |
|
|
Thread: Defining a function
Post: RE: Defining a function
(Aug-24-2024, 12:49 PM)Hudjefa Wrote: How can access the value in the variable total?You assign to variable same name or a new name a of choice.
return just return the value and close the function.
... |
|
snippsat |
General Coding Help |
6 |
382 |
Aug-24-2024, 02:36 PM |
|
|
Thread: problem for noonstop automation program
Post: RE: problem for noonstop automation program
kucingkembar Wrote:when I run the program for hours,
randomly the program does something unexpected like :Usually should not run program/task for hours/days.
This is where schedule comes in to do kin... |
|
snippsat |
News and Discussions |
2 |
386 |
Aug-24-2024, 09:51 AM |
|
|
Thread: better python text editor
Post: RE: better python text editor
kucingkembar Wrote:is there a way to auto-backup the old py when the current py is saved?As mention over TimeLine is build in into VS Code.
Look down in left corner,if click on files it will eg as her... |
|
snippsat |
News and Discussions |
12 |
748 |
Aug-23-2024, 07:07 PM |
|
|
Thread: Defining a function
Post: RE: Defining a function
Also you should not use min and max as variable names.
These name are used bye Python.
>>> min
<built-in function min>
>>> help(min)
Help on built-in function min in module bu... |
|
snippsat |
General Coding Help |
6 |
382 |
Aug-23-2024, 04:36 PM |
|
|
Thread: Dictionary using path.
Post: RE: Dictionary using path.
This should help on how to use the nested dictionary.
test_dict = {
'Q_MGR_NAME': 'BOBBEE2',
'START_DATE': '2024-08-21',
'START_TIME': '05.08.47',
'END_DATE': '2024-08-21',
'END_TI... |
|
snippsat |
General Coding Help |
5 |
315 |
Aug-22-2024, 07:27 PM |
|
|
Thread: Who can help the SyntaxError: expected ':' for forloop
Post: RE: Who can help the SyntaxError: expected ':' for...
Use code tags.
Need for i in range(1,len(list1)):
Also do not loop like this,just loop over the tags.
Example:
from bs4 import BeautifulSoup
html="""
<html>
<head>
<meta charset="utf-8"... |
|
snippsat |
News and Discussions |
1 |
203 |
Aug-22-2024, 02:59 PM |
|
|
Thread: deleting files in program files directory
Post: RE: deleting files in program files directory
(Aug-20-2024, 01:31 PM)RRADC Wrote: Probably another dumb question but what does this "if 'url_sample.csv'" do for this script?I just put in a random file to test delete from this system folder.
If ... |
|
snippsat |
General Coding Help |
6 |
467 |
Aug-21-2024, 06:11 PM |
|
|
Thread: deleting files in program files directory
Post: RE: deleting files in program files directory
Also a advice use pathlib
Example.
from pathlib import Path, PurePath
import os
folder_path = r'C:\Program Files (x86)\Microsoft'
for file_path in Path(folder_path).rglob('*'):
if file_path.... |
|
snippsat |
General Coding Help |
6 |
467 |
Aug-19-2024, 08:04 PM |