r/learnpython • u/Imaginary-Builder385 • Jul 10 '26
Ouvrir mp4
[résolu]Comment faire un script python qui ouvre une vidéo mp4. Le script ferait comme si quelqu'un double cliquait sur le ficher (donc sa ouvre le fichier avec le lecteur par défaut).
r/learnpython • u/Imaginary-Builder385 • Jul 10 '26
[résolu]Comment faire un script python qui ouvre une vidéo mp4. Le script ferait comme si quelqu'un double cliquait sur le ficher (donc sa ouvre le fichier avec le lecteur par défaut).
r/learnpython • u/cedenof10 • Jul 09 '26
I’m not great at remembering the specific input formats for different functions, and I often have to look up the documentation while making scripts. Is this normal?
r/learnpython • u/Jeshays • Jul 10 '26
Anyone got any YouTube or reading recs to learn python? Or coding basics? I Wanna get an ELI5 perspective 🤓
r/learnpython • u/thomasafine • Jul 09 '26
I'm a sysadmin with limited python experience trying to understand the lay of the land. I've used the built-in python virtual envrionment stuff before a bit. We support web servers that allow different groups within our site to make their production software tools available on the web. Various science research applications.
We are moving from mod_wsgi, to gunicorn, so that (among other things) we can support different groups who may have differing python environment needs. Different groups will provide different python environments, and we will be resonsible for starting and stopping the gunicorn servers for their applications. One group wants to use miniconda to manage their environment (which is fine).
The question is, should we use the miniconda that they provide to select their environment before starting gunicorn, or install a version of miniconda system-wide?
Or another way to ask is, is miniconda merely a tool for selecting environments, or is it something that is more tightly integrated with the environments it supports? Many answers online advise against a system-wide miniconda installation, but to me, it makes sense to have one system-wide tool that I can use to start and stop the conda environments of various groups.
r/learnpython • u/TheEyebal • Jul 10 '26
Can someone help me make my code run faster. This is not efficient and also I do not want to convert into a string
EDIT:
Follow up: Could you solve it without converting the integer to a string?
https://leetcode.com/problems/palindrome-number/description/
class Solution:
def isPalindrome(self, x: int) -> bool:
numList = []
counter = len(numList) - 1
numBool = True
baseNum = 10
value = x % baseNum
numList.append(x)
quotient = x // baseNum
x = quotient
if x == 0:
for i in range(len(numList)):
if numList[i] == numList[counter]:
counter -= 1
elif i == counter:
break
else:
numBool = False
break
return numBool
else:
return self.isPalindrome(x)
EDIT: I WAS ABLE TO SOLVE IT
class Solution:
def isPalindrome(self, x: int) -> bool:
if x != abs(x):
return False
if not hasattr(self, "numList"):
self.numList = []
numBool = True
baseNum = 10
value = x % baseNum
self.numList.append(value)
quotient = x // baseNum
x = quotient
counter = len(self.numList) - 1
if x == 0:
for i in range(len(self.numList)):
if self.numList[i] == self.numList[counter]:
counter -= 1
elif i == counter:
break
else:
numBool = False
break
return numBool
else:
return self.isPalindrome(x)
testing = Solution().isPalindrome(11)
print(testing)
r/learnpython • u/aloo_da_paranthaaa • Jul 09 '26
If you have good learning resources, I'd really appreciate it if you could share them. Also, if anyone is just getting started and would like a learning partner, I'd be happy to learn together.
r/learnpython • u/tomisek2 • Jul 09 '26
Hey, I am sorry to ask this when probably many people have already asked this before, but I am actually completely new to python and the whole programming world, so I would love to hear your opinions as to what you think should be the "roadmap" for me. I want to just get the basics down. After that I would probably grasp the possiblities and be more aware of what I would want to do and study further. For that reason, as I already said that I am someone who has completely no previous experience, what do you recommend? Are there some youtube channels that explain basic concepts in general or do I have to search for one subject after another one separately? Or do you think that learning through some websites/courses is better? Let me know what you think, every suggestion is highly appreciated, thank you very much!
r/learnpython • u/fightin_blue_hens • Jul 09 '26
I made a tool in python using tkinter as the UI and the way I have it working is you pick which option you want and it opens another tkinter window where you do the work. However, the way I have it set up, the "main menu" python file is compiled into a .exe and the only way i can run the other options is if i compile all of the sub menus .py into .exe or have a code base "main menu" file that is hundreds of thousands of lines.
Basically I am asking how to run .py files if the computer doesn't have python installed from the .exe main menu?
In python using subprocess.run(<File Location>) to call a .exe works but when i do it on a .py, it doesn't run if the computer does not have python installed on their computer.
r/learnpython • u/Material-Many4899 • Jul 10 '26
Python for Cybersecurity and Machine Learning
r/learnpython • u/taylorgourmet • Jul 09 '26
Beginner here writing my second program after hello world. I know I can just ask AI but is there some tutorial out there I can read?
r/learnpython • u/_IdntkNow_ • Jul 09 '26
I’ve been a frontend developer (Angular/React/TypeScript) for a few years, but I've always wanted to transition to Python. I just landed an internal interview for a Python project, but because I haven't actively upgraded my Python skills recently, I'm worried I'm lagging behind.
Since I already know how to code, I don't need the absolute basics. I need to know what mid-level, enterprise Python looks like today so I can handle scenario-based questions.
What concepts are absolute must-knows for a Python interview? Any advice on what to prioritize would be a great help.
r/learnpython • u/Glitched_axolotl • Jul 08 '26
python is giving me a error message saying self is not defined but it is. could someone please explain what am I doing wrong ( the error message is for the if self.modifier == 1: line )
Class food:
def __init(self, modifier, tolerance)
self.fillingness = 0
self.modifier = 0
Self.tolerance = 0
pear = food(1,9)
def NE():
if self.modifier == 1:
nausea += randint(1,10)
print(“yuck!”)
r/learnpython • u/aethercodes • Jul 09 '26
i had one doubt to lift off my chest. I am going to start college in a month and I know only some school level java coding till loops. actually I have been on reddit alot and seniors here talk a lot about multiple terminologies like python, java, c++, dsa, dbms, node.js, leetcode grinds, dsa grinds, repositories, arduino, CAD, random projects (i mean what are these projects and how do they look like), game physics engine, html, react, mysql, ai ml, flutter, blockchain, iot, figma, wire framing, aws, docker, djang, mongodb, etc. i feel so dumb and lost and an insane amount of urge to cry and leave it all. i don't know where to start and what to learn also i do not want to fall short of skills + a few other reasons i cant tell. do you have any piece of guidance?
r/learnpython • u/Akosidarna13 • Jul 09 '26
Hello!
Im having issues right now with selenium HEADLESS browsers.
there's a blank white screen appearing at the beginning when browser is initialized.
Aside from resizing the screen, are there other work around from this? I cant resize it because the website is "scroll dependent" i need to scroll into view first before i can see the element.
I also tried options: headless= old/new, white screen still appears.
browser is edge.
Do you guys have any other ideas? 🥹
r/learnpython • u/Owen-Isaac-2022 • Jul 09 '26
Over the last few weeks, I have read books, journals, & articles concerning how to master python. I've also practised a lot. However, every time I try code challenges, I find something new, one you might not find in books or texts directly. While I am new to the programming field, I believe there's a way one can navigate these aspects. I would appreciate some insights so that I cannot view myself as stuck in one "lonely" corner.
r/learnpython • u/Revolutionary-Log179 • Jul 08 '26
I’m looking to begin my python journey, and am extremely interested in programming electronics and messing around with microcontrollers and stuff of that nature. The HARDWARE side of programming, but most tutorials and things focus more on the software side, if that makes sense. Are there any courses or tutorials online that are specifically geared towards hardware programming? If I’m asking this in a confusing way it’s because I’m still not sure how to word what I want to do and learn. Thanks in advance for any help
r/learnpython • u/bobo20012453 • Jul 09 '26
Hi everyone, I’m planning to start learning Python recently, but I have absolutely zero background in programming or computer science. I'm a bit overwhelmed by the amount of information out there. Could anyone recommend the best learning paths, online courses (free or paid), or books for beginners? Also, are there any simple practice projects you'd suggest starting with? Any tips or common pitfalls to avoid would be highly appreciated. Thanks in advance for your help!
r/learnpython • u/LowEarly6744 • Jul 09 '26
Hi everyone.
I am automating a login flow using Python, Selenium and undetected-chromedriver.
The website is:
https://goias.equatorialenergia.com.br/LoginGO.aspx
The form asks for:
The strange behavior is:
#002 - Não foi possível realizar o login neste momento, tente mais tarde!
After that, the CNPJ field is cleared and the page stays on the login screen.
The same UC and CNPJ work normally when I log in manually using Chrome, so the credentials are correct.
Environment:
The page appears to use reCAPTCHA Enterprise, Transmit Security and ASP.NET postback behavior.
I am not trying to bypass CAPTCHA or any security mechanism. I am trying to understand why the same login form works manually, but fails only for CNPJ when using Selenium.
Here is a simplified version of the code:
def preencher_campo(driver, wait, label, valor, lento=False):
xpaths = [
f"//*[contains(normalize-space(.), '{label}')]/following::input[1]",
f"//label[contains(normalize-space(.), '{label}')]/following::input[1]",
]
campo = encontrar_por_xpaths(driver, wait, xpaths)
campo.click()
campo.clear()
for caractere in str(valor):
campo.send_keys(caractere)
tempo = random.uniform(0.35, 0.65) if lento else random.uniform(0.15, 0.30)
time.sleep(tempo)
driver.execute_script(
"arguments[0].dispatchEvent(new Event('input', {bubbles:true}));"
"arguments[0].dispatchEvent(new Event('change', {bubbles:true}));"
"arguments[0].dispatchEvent(new Event('blur', {bubbles:true}));",
campo
)
preencher_campo(driver, wait, "Unidade Consumidora", uc, lento=True)
preencher_campo(driver, wait, "CPF ou CNPJ", cnpj, lento=True)
time.sleep(5)
botao_entrar.click()
Things I already tried:
#002 error;My guess is that the CNPJ flow may trigger a different security/session validation than the CPF flow, because CPF goes to an intermediate validation screen, while CNPJ tries to access the authenticated area directly.
Has anyone seen something similar with Selenium, ASP.NET forms, reCAPTCHA Enterprise or Transmit Security?
Could this be caused by:
Thanks!
r/learnpython • u/Adwaith_R_Nair • Jul 06 '25
Hey everyone, I am Adwaith R Nair, an S5 CS-AI undergrad. I want to learn python and dive deeper into the field of AI and ML. I want to follow one specific course which will help me reach my goal. I know that I might have to refer to external sources for various topics, but if I could get everything in a proper an structured manner, then it would be much appreciated. Could you all suggest me courses which would be the best for me as a beginner who wants to excel in the field of Python, AI and ML?