Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Import vs from x import
Post: RE: Import vs from x import
# Creds.py
class Server1: …
class Server2: …Here, Creds is a module whose attributes happen to be two classes. You do
import Creds
print(Creds.Server2.randkey)Modules are singletons in sys.modules,t... |
|
snippsat |
General Coding Help |
1 |
154 |
May-15-2025, 04:09 PM |
|
|
Thread: Return a string or byte object from Enum class?
Post: RE: Return a string or byte object from Enum class...
(May-14-2025, 02:45 PM)Calab Wrote: 'm thinking that forgetting about Enum and just using class attributes is the best answer.Yes look like not needed in this task.
Could use a frozen @dataclass to ... |
|
snippsat |
General Coding Help |
5 |
402 |
May-14-2025, 05:21 PM |
|
|
Thread: [SOLVED] [Beautiful Soup] How to deprettify?
Post: RE: [Beautiful Soup] How to deprettify?
To show the problem.
from bs4 import BeautifulSoup
html = '''\
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph</p>
<p>blue car</p>
</body&g... |
|
snippsat |
General Coding Help |
3 |
522 |
May-01-2025, 11:15 AM |
|
|
Thread: where should DEFAULT_CIPHERS be found?
Post: RE: where should DEFAULT_CIPHERS be found?
(May-01-2025, 05:04 AM)Larz60+ Wrote: Are there any telemetry concerns with uv?No uv is a fully open-source (Apache/MIT) binary with no hidden telemetry back-ends. |
|
snippsat |
General Coding Help |
8 |
841 |
May-01-2025, 07:00 AM |
|
|
Thread: where should DEFAULT_CIPHERS be found?
Post: RE: where should DEFAULT_CIPHERS be found?
Try uv it replaces pyenv and lot more,it will(has) be the default choice for a Python package and project manager.
uv install python and it work on all OS also a lot faster than other stuff,eg see un... |
|
snippsat |
General Coding Help |
8 |
841 |
Apr-30-2025, 10:42 PM |
|
|
Thread: what name to give to a new function?
Post: RE: what name to give to a new function?
Some advice you’ll want a non-blocking sleep,so that other coroutines can make progress while you’re waiting for your phase.
Swap out time.sleep()(blocking) for asyncio.sleep() and use the event loop... |
|
snippsat |
News and Discussions |
4 |
564 |
Apr-30-2025, 01:23 PM |
|
|
Thread: Converting Pandas DataFrame to a table of hourly blocks
Post: RE: Converting Pandas DataFrame to a table of hour...
Can do it like this,it's a little tricky to get CSS placement right.
Generate a schedule.html
import pandas as pd
df = pd.DataFrame({
'courseid': ['CHEM1250', 'CHEM1250', 'CHEM1250',
... |
|
snippsat |
General Coding Help |
1 |
666 |
Apr-24-2025, 01:05 PM |
|
|
Thread: how to change account name
Post: RE: how to change account name
Can not have special characters as @,so is ballinpy ok? |
|
snippsat |
Board |
3 |
531 |
Apr-22-2025, 06:46 PM |
|
|
Thread: Python inner classes inheritance from parent class
Post: RE: Python inner classes inheritance from parent c...
(Apr-22-2025, 04:16 AM)Abedin Wrote: I think it is much cleaner if I was able to do schedule.Course('CHEM1250').show or e.g. schedule.Course('CHEM1250').take_smaller_subset and do something else wit... |
|
snippsat |
General Coding Help |
8 |
1,170 |
Apr-22-2025, 03:00 PM |
|
|
Thread: how to get qualified objects in a list
Post: RE: how to get qualified objects in a list
Some advices and fixes.
Don’t overwrite self. want to keep your object instance.
Update input state each frame.
Call pygame.key.get_pressed() and pygame.mouse.get_pressed() inside your main loop, not... |
|
snippsat |
General Coding Help |
5 |
702 |
Apr-21-2025, 02:10 PM |
|
|
Thread: how to change account name
Post: RE: how to change account name
Post new wanted name,so can i change it |
|
snippsat |
Board |
3 |
531 |
Apr-20-2025, 07:12 AM |
|
|
Thread: image does not show with pillow
Post: RE: image does not show with pillow
(Apr-13-2025, 07:32 PM)BashBedlam Wrote: It knows that the image is 480/360 RGB but will not display it.Error you see when calling im.show() indicates that the external image viewer that pillow tryi... |
|
snippsat |
General Coding Help |
5 |
1,640 |
Apr-13-2025, 07:53 PM |
|
|
Thread: Python GDB scripts for Fedora41
Post: RE: Python GDB scripts for Fedora41
The key issue seems to be the mismatch between where your Python binary expects to find the library (/lib64/) and where the debug scripts are configured (/usr/lib64/).
One straightforward fix is to cr... |
|
snippsat |
General Coding Help |
3 |
820 |
Apr-13-2025, 08:09 AM |
|
|
Thread: Why does datetime.strptime() not work in this situation
Post: RE: Why does datetime.strptime() not work in this ...
The issue here is with parsing timezone information using strptime().
Python's strptime() has limited support for timezone parsing with %Z.
Can do it like this.
from datetime import datetime
import py... |
|
snippsat |
General Coding Help |
2 |
912 |
Apr-08-2025, 06:36 PM |
|
|
Thread: pyperclip stopped working
Post: RE: pyperclip stopped working
OAP Wrote:When I use pip I get an error message
"This environment is externally managed
╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are tr... |
|
snippsat |
General Coding Help |
8 |
1,193 |
Apr-04-2025, 09:15 PM |
|
|
Thread: pyperclip stopped working
Post: RE: pyperclip stopped working
Do pip --version to see what version it install to.
If wrong use python -m pip install pyperclip
Now should use uv🚀,it makes all easier(will download Python version if not on OS) and faster.
Here a ... |
|
snippsat |
General Coding Help |
8 |
1,193 |
Apr-04-2025, 05:53 PM |
|
|
Thread: asyncio interval
Post: RE: asyncio interval
(Mar-27-2025, 01:24 AM)Larz60+ Wrote: (getting to be an old man, near 80),Still going 💪
Can try something like this bigal.
import asyncio
from common import SampleConfig
async def swap_frequencie... |
|
snippsat |
General Coding Help |
8 |
1,326 |
Mar-28-2025, 05:49 PM |
|
|
Thread: PIP doesn't work
Post: RE: PIP doesn't work
(Mar-27-2025, 01:01 PM)YKR Wrote: May be somebody knows how to fix this issue or may be some proposalThe general advice now is to use uv,is better/faster and should also fix the issue.
The issue of... |
|
snippsat |
General Coding Help |
1 |
770 |
Mar-28-2025, 02:10 PM |
|
|
Thread: Online Python Editor
Post: RE: Online Python Editor
Codespaces(use VS Code online and Terminal works), AWS Cloud9(own made browser editor and Terminal works), Replit, Google Colab(Jupyter Notebook online) |
|
snippsat |
General Coding Help |
4 |
802 |
Mar-26-2025, 03:18 PM |
|
|
Thread: pip
Post: RE: pip
Use uv,there really no need to install Python in OS anymore uv take care of that.
Eg if do this on new pc it will install Python 3.13.1 and use i uv pip to install eg request,the speed is also lot fas... |
|
snippsat |
General Coding Help |
3 |
1,020 |
Mar-25-2025, 07:46 PM |