python | Unsorted

Telegram-канал python - Python

135201

You will be muted until you read the rules. Read them! @Rules_for_Python A group about the Python programming language. Offtopic things go here: @pythonofftopic Resources to learn python: @pythonres Group for Hy: @hylang Selenium: @SeleniumPython

Subscribe to a channel

Python

This is not a Python specific question, please delete your offtopic message, move to @PythonOfftopic and ask there.

Читать полностью…

Python

looks like you need an offtopic group, please delete the off-topic message(s) and continue this conversation at @pythonofftopic

Читать полностью…

Python

Depends on when u have to check the data

If you have to check the data before going to output, it's enough make a function which verifies the data

While if you have to check the data when them arrive, you have to just check the data before the function's logic

Читать полностью…

Python

So in my function executeion way i need to check if both is None, return Runtime error like this saying both cannot None... 😋

Читать полностью…

Python

Python, as every language, is not a dynamic language, so u cannot check in realtime if the user gives all the necessary data

U can check it only when u execute the code

Читать полностью…

Python

Suppose i have a function like this below:

def set_identity_key(
key: str
email: str | None = None,
phone: str | None = None,
) -> None:

data = {
"email": email,
"phone": phone,
}

set_key(
key=key,
value=data,
)

Since both email and phone default to None, it looks like both are optional.
But my requirement is: at least one of email or phone must be provided — either one or both are valid.
Is there a clean way to express this requirement using Python type hints? Or is the best approach simply to validate it at runtime? 🤔
I know type hints aren't enforced at runtime, but ideally I'd like the type hint to communicate this requirement clearly.

Читать полностью…

Python

See i am when try to use flask, i found the thigns we need to store some data in the user's browser's cookie like

from flask import session
session[pending_register_email] = user_email_id@email.com

what i say after i run this in my routes.py's /register endpoing function , this data got saved inthe user's browser's cookie.

But any way i can say after 5 minute this particular session data will be deleted from the browser's cookie?

another thigns keep like this is perfectly ok with no security problem, as later i will do get this value of the pending_regiser_email and verify the otp stored in my server's cache.?

Читать полностью…

Python

Guys, I have a question about my current project.
Users upload documents to our app, and we currently send the PDF directly to the LLM. The PDFs are around 50–120 pages and can contain tables, handwritten content, etc., so Gemini is becoming very expensive.
My task is to reduce the cost. I tried OCR with image processing, but the extracted data is not accurate.
So, is there any better approach to extract the data without using OCR, while keeping good accuracy and reducing the LLM cost?
Please suggest some approaches, guys.

Читать полностью…

Python

Hello everyone, I'm Joshua.
I'm excited to learn about cyber security and python programming .

The only thing I know right now is print("hello world")

I hope you guys see me grow from a beginner to master.

I'm open to mentorship and accountability partners

Читать полностью…

Python

/Automation/General/chapter1.py
Enter your name: Jj
Enter your password Joe: Joe
Enter your name: C:\Users\HP\AppData\Local\Programs\Python\Python314\python.exe k:/Coursera/Python/Automat
ion/General/chapter1.py
Enter your password Joe: ww
Enter your name: kk
Enter your password Joe: C:\Users\HP\AppData\Local\Programs\Python\Python314\python.exe k:/Coursera/Python
/Automation/General/chapter1.py
Enter your name: jj
Enter your password Joe: C:\Users\HP\AppData\Local\Programs\Python\Python314\python.exe k:/Coursera/Python
/Automation/General/chapter1.py

Читать полностью…

Python

Screenshot of output please

Читать полностью…

Python

Naukri Campus is hosting the India's biggest skill contest to help you stand out to recruiters, win prizes, and more! Don't miss out, enrol now here:
https://www.naukri.com/campus/contests/young-turks-skills-assessment-test?action=enrol&referral=e2000105-rY4PEHZ-pseu&uapp=8010&utm_source=share_pwa&utm_medium=referral

Читать полностью…

Python

yaa it was very basic i was so glad to recall this, but still i need to know a little more about generator making 💚

Читать полностью…

Python

yaa yaa sorry, i need to ask why not tuple 😅

Читать полностью…

Python

squares_list = [x * x for x in range(1000000)] 
squares_gen = (x * x for x in range(1000000))

Why first one is list second one is generator not set? which part say it to work like yield here? 💭🤔🧠

Читать полностью…

Python

If you know the basics well and just stucking in problem versus solutions, then learning the basics again and again is not recommended. It's a learning loop where you will be trapped for long period.
Instead, practise on leetcode

Читать полностью…

Python

Anyone having job link for apply

Читать полностью…

Python

Python groups in other languages
(⚠️Not managed by us ‼️)

Arabic @arabipython
Azerbaijani @azepug
Chinese @pythonzh
French @python_francais
German @pythonde
Hebrew @pythonisrael
Tamil @pythontamilcommunity
Indonesian @pythonid
Italian @python_ita @pythonita
Kazakh @python_kz
Malaysia @pythonmalaysia
Persian @pyfarsi
Portuguese @pythonbr
Russian @ru_python_beginners @ru_python @python_scripts
Spanish @PythonEsp
Swahili @python_eafrica
Turkish @python_tr
Uzbek @python_uz

If you have an active and well managed group that you want to be listed there, ask in the Meta group, link in the rules page.

Читать полностью…

Python

Type hints only says the method/variable details, nothing more

Читать полностью…

Python

This method only sets the value, so u have to make a verify method and using it when is supposed to be used (for example, before the output)

Читать полностью…

Python

I tried your code and it is working perfectly just as the example from the book.

Читать полностью…

Python

a human probably would do it cheaper and better

Читать полностью…

Python

Good u know the 1% of the basics

Читать полностью…

Python

But for some reason, it went away now. Idk why!
Same code, same everything.

Читать полностью…

Python

I can't due to the group policy
So, I used AI to copy the output:

Читать полностью…

Python

I picked up "Automate the boring stuff with python" and I was reviewing the basics again.
Chapter1-Chapter8.

# book refrence:
while True:
print('Who are you?')
name = input('>')
if name != 'Joe':
continue
print('Hello, Joe. What is the password? (It is a fish.)')
password = input('>')
if password == 'swordfish':
break
print('Access granted.')
......
#This is my attempt to do it with less lines:

while True:
name = input("Enter your name: ")
if name != "Joe":
continue
password = input("Enter your password Joe: ")
if password == "dumbass":
break
print("Access granted!")

The problem I am facing is that my code reveals the second line after 'continue ' even tho the password is wrong.

Читать полностью…

Python

This is inline generator without any logic on data. If you want to apply logic, better to create with proper yield statement.

Читать полностью…

Python

Tuples defies with multiple values with comma separated.

Читать полностью…

Python

First expression is for list comprehension and second one is for generator.
To create set, you must define with set keyword. By the way, () is symbol of tuple.

Читать полностью…

Python

https://pythonbooks.org/free-books/

Читать полностью…
Subscribe to a channel