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 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/

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

Python

Hello everybody, could you please suggest a comprehensive course for Python ?

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

Python

num1 = int(input("le premier sifre : ..."))
num2 = int(input("LE deuxieme sifre : ..."))

operation = input("rentre votre operation ( +, -, *, / ) : ...")


if operation == "+":
print("sonucunuz : " , num1 + num2)
elif operation == "-":
print("sonucunuz : " , num1 - num2)
elif operation == "*":
print("sonucunuz : " , num1 * num2)
elif operation == "/":
print("sonucunuz : " , num1 / num2)

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

Python

Can you teach me Python?

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

Python

Lets not spam this group anymore, switch to Discord please

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

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

like a PDF or something

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

Python

I know a little bit.

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

Python

Check out @PythonRes, a channel for Python resources - video courses, pdf books, tutorials and other info to help you learn Python.

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

Python

i will give my all code example and just ask there with proper traceback?
will this disussable in ur ledger

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

Python

so actually the problem is what i will stated with my code example:-

is this the yield session not working here in flask-di, as i see in fastapi they just has yield session, and in the fun parameter variable:sessionDep lile this works so perfectly, so my main point of open a issue to saying this to work like fastapi

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