sub
stringclasses
1 value
title
stringlengths
7
303
selftext
stringlengths
0
8.65k
upvote_ratio
float64
0.08
1
id
stringlengths
9
9
created_utc
float64
1.65B
1.65B
Python
Programming languages: Python just got a boost from Facebook's Meta
0.4
t3_ts1al4
1,648,626,768
Python
Understanding __init__ Method in Python
0.73
t3_ts0cgt
1,648,622,580
Python
How do you define beginner, intermediate, and advanced?
These terms are used frequently, but many seem to often disagree on them. Could be used to describe a persons knowledge, competence, or the qualiry od code/codebase etc. I would say a beginner is just someone who is learning the actual language, syntax, just learning to code. Maybe touching on the common built-in libraries, learning classes, and basic OOP. Intermediate is past the syntax and basic concepts and is using libraries. Intermediate is a lot longer phase, I think. Intermediate is learning about programming concepts, practices, patterns, design, libraries, ... Advanced (again, in my perspective) is not a wizard who knows Python internals and corners of the python object model. It's someone who can create useful, well-structured programs from the ground up properly, using the right tools and libraries. Not just doing practice projects, but a larger product properly. Able to pretty much learn any technology needed for a project. What do you think? What do you disagree with?
0.92
t3_try32l
1,648,613,843
Python
ipyvizzu - create animated charts in Jupyter Notebook using Python with this open-source tool
Hey, We've built and released a new integration of our open-source charting library Vizzu. We hope this will help data scientists and analysts share their insights easier by utilizing animation for storytelling with data. We'd love to know what you think about it. More info, tutorial & examples: [https://github.com/vizzuhq/ipyvizzu](https://github.com/vizzuhq/ipyvizzu) Here's a short video illustrating how ipyvizzu works. https://reddit.com/link/trxyg5/video/j6rd94q6mcq81/player
0.77
t3_trxyg5
1,648,613,371
Python
Wednesday Daily Thread: Beginner questions
New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions! This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at [https://discord.gg/python](https://discord.gg/python) where you stand a better chance of receiving a response.
1
t3_trtfcd
1,648,598,410
Python
Looking for tips
I made a program to try and simplify square root radicals with python. I would like to get some feedback and tips on how to write some better code. [https://github.com/Falt-b/simpliify-radicals](https://github.com/Falt-b/simpliify-radicals)
0.8
t3_trlofs
1,648,587,916
Python
I made a web-based Instagram bot that scrapes people's usernames and follows/unfollow them
​ https://reddit.com/link/tre7to/video/nf7rtqni9dq81/player
0.86
t3_tre7to
1,648,579,177
Python
Multi-threaded Omegle bot with proxy support and other neat features, like content spinning and typo generator.
[https://github.com/embium/Omeglebot](https://github.com/embium/Omeglebot) # Omeglebot Multi-threaded Omegle bot with proxy support and other neat features, like content spinning and typo generator. I'm not even sure it's possible to run without proxies. I could sell this but I rather release it publicly. This supported me financially for a few years. Enjoy.
0.76
t3_tre8z9
1,648,579,265
Python
pync - Netcat for Python
Hi, I've been reading Black Hat Python and decided to try and make a Netcat library for Python developers. It's not fully there yet (there's a few things I still need to do), but I thought I'd share it anyway in hopes that someone might find it useful. Anyway, here's the [GitHub repo](https://github.com/brenw0rth/pync) for the project if you're interested. Any feedback or criticism is welcome, thank you. 😊
0.84
t3_tre60y
1,648,579,046
Python
Any idea when Spyder Notebook will be stable and running for Spyder 5?
I would like to use it
0.33
t3_trbyzk
1,648,577,411
Python
Tomorrow: a live 45-minutes session on the fundamentals of observability, OpenTelemetry, and distributed tracing in Python
Hi everyone, a quick reminder about the live OpenTelemetry and observability fundamentals session - in 2 days, Wednesday, March 30 at 11 AM PST. You will learn how to instrument your apps to capture traces with OpenTelemetry in Python. This session is at no cost and vendor-neutral. You can expect in this session: 45 minutes of core concepts, how to deploy it yourself hands-on + Q&A. If you are interested in observability, OpenTelemetry, and tracing - join! Register here [https://www.aspecto.io/get-started-with-opentelemetry/](https://www.aspecto.io/get-started-with-opentelemetry/?utm_source=post&utm_medium=reddit&utm_campaign=r-python-opentelemetry-workshop-pyhon-march-30-2022)
0.87
t3_tra9f1
1,648,574,859
Python
I built a real-time stock tracker using Python + Fast API, Alpaca, Next.js, and Redis Stack. Check it out!
0.67
t3_tra4u1
1,648,574,515
Python
I love type annotations, so I made a quick tutorial on how to add types to Flask SQLAlchemy
1
t3_tr9r9n
1,648,573,518
Python
IndiePython.com - content about indie projects using Python (specially gamedev)
Hello, I'd like to present a website ([indiepython.com](http://indiepython.com)) I created to publish content about my indie Python projects including apps and games. It is still a work in progress, but it already has a lot of content about projects I'll be releasing, including, for instance, a node editor to be released on June 2022 like you can see below. My apps and their source code are free of charge and will be released to the public domain, both on github and pypi (can be installed via "pip install" command). [Nodezator \(node editor to be released on June 2022 to the public domain\)](https://reddit.com/link/tr5l1q/video/qfelxkvcicq81/player) It should feature other content like tutorials/articles as well in the future. Thanks for your time.
0.6
t3_tr5l1q
1,648,569,821
Python
If a person posts Python code to Amazon Web Services can it run all the normal Python libraries? I was thinking to a greater extent about moviepy.editor.
If a person posts Python code to Amazon Web Services can it run all the normal Python libraries? I was thinking to a greater extent about moviepy.editor.
0.55
t3_tr43cm
1,648,566,871
Python
Boss told me to learn python.
Got told I need to learn python from my boss, where should I start? Codeacademy? Like how they are teaching you there. But how good is it? Better places to learn? *Edit* My boss wants me to learn to program for robots and different task for automation of tasks. He told me I should learn the basics and then more about that field. Thinking something like making bots should be a good project? Current knowledge is Visual Basic some years ago.
0.83
t3_tr31rs
1,648,566,271
Python
Garmin Connect File Manager
Hey everyone, I put together [this project](https://github.com/lucas-nelson-uiuc/garmin-connect-file-manager/tree/main) to help me store (and, in the future, analyze) activities recorded on my Garmin to my local computer. It builds off the popular [gcexport](https://github.com/kjkjava/garmin-connect-export) repo with additional functionality including summary/geographical data extraction as well as activity-based sorting. Feel free to look things over if you're looking to critique someone's code today and/or implement this in your Garmin data backup routine.
0.6
t3_tr2oml
1,648,566,073
Python
Pagination for a User-Friendly Django App – Real Python
1
t3_tr1m2y
1,648,564,625
Python
Loading config from the environment in Quart & Flask
1
t3_tqz50j
1,648,558,577
Python
What is a Lambda function and its applications in Python
In this short article, I'm gonna explain Python's lambda functions in detail. A lambda function is a small anonymous function that can take any number of arguments but can only have one expression. Here is its syntax: **lambda arguments : expression** The expression is executed and the result is returned. ## Example: Add 10 to argument a, and return the result: x = lambda a : a + 10 print(x(5)) The result would be 15. (You could try this in a python IDE such as vs code) ========================================================================= Lambda functions can take any number of arguments: ## Example: Multiply argument a with argument b and return the result: x = lambda a, b : a * b print(x(5, 6)) The result would be 30. ========================================================================= **Why Use Lambda Functions?** The power of lambda is better shown when you use them as an anonymous function inside another function. Say you have a function definition that takes one argument, and that argument will be multiplied by an unknown number: def myfunc(n): return lambda a : a * n Use that function definition to make a function that always doubles the number you send in: ## Example: def myfunc(n): return lambda a : a * n mydoubler = myfunc(2) print(mydoubler(11)) The result would be 22. ========================================================================= Use lambda functions when an anonymous function is required for a short period of time. If you would like to watch the video version of this tutorial, you could click on the following link: [https://www.youtube.com/watch?v=DGUl5Uwz3g8](https://www.youtube.com/watch?v=DGUl5Uwz3g8) **#python** **#pythonlambda** **#lambdafunction**
0.44
t3_tqyil5
1,648,556,436
Python
My first coding project: Twitter Plays Wordle
After starting my coding journey 3 months ago, I've finally made something that isn't a terminal calculator app :0 So I made [Twitter Plays Wordle](https://twitter.com/WordleGame_Bot) ([github](https://github.com/afnzmn/twitter-plays-wordle)), a twitter bot that uses replies to its tweet as guesses for a Wordle game. The bot first checks if it's a fresh game. If yes, it tweets a blank Wordle grid. If it isn't, then it searches for the replies to its newest tweet, and checks to see if it has a guess in it. This can either be a reply with just a five letter word, or a five letter \[guess\] contained in square brackets. It adds this to a replies.csv. Then, it sorts the guesses by the likes, and uses the most liked valid reply as the guess. It then plugs the guess into a Wordle function, which just runs an algorithm for detecting what coloured square goes where, and adding it to a list. The list then gets joined and pushed out with other Wordle things for the Twitter bot to tweet. Finally, it adds the Wordle grid into a text file, and updates a csv on the current row position, the word number, and the win state to be used for the next tweet. If you want to play it, here's the most [recent tweet](https://twitter.com/WordleGame_Bot/status/1508769809550434309) Currently, I'm just running this on my old laptop since I can't really buy a hosting service, and iirc Heroku wouldn't run for the entire month with its free plan. If someone has an alternative, please let me know! (also if you wanna roast my code, you're welcome to do so)
0.6
t3_tqxx94
1,648,554,369
Python
The history of performing functions in Django
A question from a beginner. The [article](https://russianblogs.com/article/45611627794/) discusses what happens after the command is called *manage.p**y runserver* Is there any way to see this in the form of a "log" or similar functionality, not only after calling this particular command, but also after any actions, for example, in the admin panel, etc.?
1
t3_tqxkg9
1,648,553,092
Python
Sourcepy: source python files straight from the shell
Hey folks, sharing a project I built just for fun, Sourcepy: [https://github.com/dchevell/sourcepy](https://github.com/dchevell/sourcepy) I was writing some increasingly messy shell functions and thought it would be nice if I could just write Python functions/variables/etc. instead and source them from the shell. So … that's what this is. It uses a mix of importlib and inspect machinery to "source" files (in reality, generating shell stubs that hook back into a bridging interface, and aliasing \`source\` so it works just like you’d expect). Along the way I ended up deep diving into type annotations and turning plain python functions into dynamic command line apps that can coerce to native values, handle stdin, work with a large variety of types & objects and do a number of other interesting things - all without your code having to know a thing about Sourcepy. You write plain old python functions, add typehints to the parameters for the best results, and in most cases it should "just work".\* This is still a work in progress - its use case is largely for folks like me who like excuses to mess around in Python and customise their environment and toolset to an unnecessary degree. Try it out, share any suggestions (or bugs, or criticism). I've poked around looking for similar projects and the only similar thing I could find required running a daemon which wasn't an approach I liked, so hopefully you'll find some novelty here. ^(\*not a guarantee)
0.95
t3_tqwyrh
1,648,550,680
Python
Actual unique fun project ideas: Beginner | Intermediate | Advanced
Beginner: - Write a python function that creates 10 folders numbered 1-10 (hint: use context managers) - Using PILLOW, generate simple white noise images by randomly toggling individual pixel Colours between black and white in an MxN image (hint: use nested for loops) - Write a script that prints “Hello World” in red coloured text in the terminal. (hint: look up ANSI escape codes and run this script in the terminal) - Create a virtual environment with the built in venv library. Activate this environment. pip install pandas. Confirm the install with pip ls. pip uninstall pandas. (hint: you’ll learn about environments) Intermediate: - Using PILLOW, again generate simple white noise images, but this time by randomly toggling individual pixel Colours between any possible RGB value in an MxN image (hint: use nested for loops) - Create a python decorator to run any function you define in an infinite loop (hint: @) - Write a script that can simply parse large json files (1GB+) (hint: you’ll learn about memory management and memory allocation errors) - Create a bare minimum Flask app to convert temperatures (F to C) - no CSS. (You’ll learn a bit about packages and HTML) - Create a Bash Makefile.sh that automates the creation and activation of a virtual environment, and also pip installs pandas. Run this bash file. (hint: assumes Linux) Advanced: - Using PILLOW and any coloured image as INPUT, write an algorithm that gradually decreases the brightness of an image radially towards the centre pixel - Create a bare minimum python based inverted index (like Elasticsearch) (hint: you’ll learn about Classes, NLP, and basic algorithms) - Create a Selenium bot to enter random characters into any <input> HTML element on any website (hint: learn about “inspect element” in the browser)
0.9
t3_tqvytp
1,648,546,376
Python
EXPENSE-TRACKER -> An application to keep your expenses organized
Hey all, few days ago, I have made a post of making an expense tracker - [here](https://www.reddit.com/r/Python/comments/slbhbi/expensetracker_an_application_to_keep_your/). And you all have helped me improving it. Thanks to all. # MODIFICATION SO, I thought to change the entire project into a package which can be used by installing it through pip. First of all, I change the code structure to classes and objects. then add one decent functionality - Currency converter Previously, to show the expenses more clearly I use graphs. Now, I made another option of changing the currency of your expenses and compare it from the previous. Here, I have used tan API. # INSTALLATION AND CODE You can see the code as usual on github - [here](https://github.com/Shreejan-35/EXPENSE-TRACKER). Here you can get all information. You can install it using pip by the following ways - ``` pip install expense-tracker ``` OR ``` pip3 install exprense-tracker ``` Then run, ``` expense-tracker ``` I was lucky that no one has till now taken **expense-tracker** as a name. That's all to say. You can follow me on instagram - [@star_cyber_warrior](https://www.instagram.com/star_cyber_warrior/)
0.57
t3_tqvrl9
1,648,545,457
Python
How To Hire a Python Web Development Company for Your Project?
0.25
t3_tqv3v9
1,648,542,428
Python
Top 10 Python Data Science Projects with Source Code
0.71
t3_tqu35m
1,648,537,849
Python
I'm presenting live in 9 hours at Microsoft Reactor online about Python and Kubernetes. Let me know your questions in advance
0.85
t3_tqta40
1,648,534,367
Python
My python git binding
hi, i know there are already great python library for git. but i need simple library and working with all git & python 3 version, so i made this binding [https://github.com/guangrei/Gitpybinding](https://github.com/guangrei/Gitpybinding) glad to hear your thoughts 🙏
0.88
t3_tqolbm
1,648,517,515
Python
First Full Stack, Mobile Friendly App (Flask)
Yet To Be Named Poll Based Matching App: [http://54.198.186.121:8080/](http://54.198.186.121:8080/) I was listening to a podcast at a company I want to work for and the host was talking about this idea for an app. I ended up building it to get my foot in the door and build out my project portfolio. This is my first production deployment ever. I'd like to get a little foot-traffic and feedback which is what brings me here. Currently, signup is required to view anything, however, user authentication is by the book using various flask based modules so all sensitive user data is encrypted. I think it's a tremendous example of what python is capable of. The whole app is 500ish python lines coupled with a few HTML pages, SQL queries, and a CSS stylesheet. With that said, I encourage you to sign up, and either make or take a poll. All feedback is welcome in the comments!
1
t3_tqn48r
1,648,512,727
Python
Tuesday Daily Thread: Advanced questions
Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python. **If your question is a beginner question we hold a beginner Daily Thread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.** This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at [https://discord.gg/python](https://discord.gg/python) where you stand a better chance of receiving a response.
0.85
t3_tqmvv4
1,648,512,009
Python
Question: best ways to build Python command line utilities
I have two medium size (less than 1000 lines each) code bases that I would like to make into two command line utilities. Two obvious approaches are: 1. Add a \_\_main\_\_.py file and a [setup.py](https://setup.py) to a module, and do a python [setup.ps](https://setup.ps) install 2. Copy all source files into a single Python source file that starts with *#!/usr/bin/env python, and put script in PATH.* To complicate matters, I use several different condo environments that I switch between. Is there an accepted best practice for this?
0.85
t3_tqgwm3
1,648,494,868
Python
ONNX to PyTorch
We have released our Python Open Source tool for conversion ONNX models to PyTorch. Almost all Computer Vision neural networks architectures are supported. Please try it. [https://github.com/ENOT-AutoDL/onnx2torch](https://github.com/ENOT-AutoDL/onnx2torch?fbclid=IwAR1HpWxialVy-ILdHUYR8CJ_EsUyxbjhrMkZbWPWkQ0DuNuwvYDEpNVuhqc) I ask the Data Science community to support the project with a star on GitHub.
0.88
t3_tqgjsk
1,648,493,932
Python
Software Engineering Tools and Best Practices for Data Science
0.5
t3_tqfr47
1,648,491,771
Python
A zoo for decorators
Hello there! First time posting here :) Last week I worked on a small python library and wanted to share it! Reason for the library is that I found myself copy-pasting some python decorators over and over across multiple projects. Library is called deczoo (a zoo for decorators) and it's pip-installable. docs: [https://fbruzzesi.github.io/deczoo/](https://fbruzzesi.github.io/deczoo/) repo: [https://github.com/FBruzzesi/deczoo](https://github.com/FBruzzesi/deczoo)
0.5
t3_tqefp4
1,648,488,239
Python
I made my own Task Deadline Tracker using Python!
Hi all, I'm really excited to share this little project I've finally finished! Meet Tasky, a program made using tkinter that will track the deadlines for the task you feed in and show you the time remaining for your tasks (for example 3d 2h 57m left for some task). I use it regularly to track my own tasks and thus plan accordingly. It's been really helpful to me. You can add, delete and edit tasks in it too. Hope you all like it :) [Image showing Labelled Parts of Tasky](https://user-images.githubusercontent.com/68178267/160485795-411c9ccb-a133-4eea-a3ac-213c91ae2669.png) More info and features: [Github Repo](https://github.com/AbhiK002/Tasky/) ​ [It comes in 2 themes as well!](https://preview.redd.it/3dcztj22p5q81.png?width=965&format=png&auto=webp&s=618c3f6e291f9e84a3816a675f6d3bb9dd416379)
0.94
t3_tqe3tx
1,648,487,360
Python
Python project that swipes for me on Tinder
demo link: [https://youtu.be/mRbEcqf1xLw](https://youtu.be/mRbEcqf1xLw) (the code breakdown link is in the description of the demo)
0.6
t3_tqdf63
1,648,485,556
Python
In 2 days, running a live 45-minutes session on the fundamentals of observability, OpenTelemetry, and distributed tracing in Python
Hi everyone, there's a live OpenTelemetry and observability fundamentals session - in 2 days, Wednesday, March 30 at 11 AM PST. **You will learn how to instrument your apps to capture traces with OpenTelemetry in Python.** This session is at no cost and vendor-neutral. You can expect in this session: 45 minutes of core concepts, how to deploy it yourself hands-on + Q&A. If you are interested in observability, OpenTelemetry, and tracing - this is the place to be! Register here [https://www.aspecto.io/get-started-with-opentelemetry/](https://www.aspecto.io/get-started-with-opentelemetry/?utm_source=post&utm_medium=reddit&utm_campaign=r-python-opentelemetry-workshop-pyhon-march-30-2022)
0.66
t3_tqd44k
1,648,484,744
Python
Solverecaptchas - An async Python library to automate solving ReCAPTCHA v2 using Playwright.
[https://github.com/embium/solverecaptchas](https://github.com/embium/solverecaptchas) Solves audio and image types! ## Compatibility Linux, macOS, and Windows! ## Installation $ pip install solverecaptchas ## Usage import asyncio import sys from solverecaptchas.solver import Solver if len(sys.argv) == 4: pageurl, sitekey, proxy = sys.argv[1:] else: print('Invalid number of arguments (pageurl, sitekey, proxy)') sys.exit(0) if proxy.lower() == "none": proxy = None client = Solver(pageurl, sitekey, proxy=proxy) result = asyncio.run(client.start()) if result: print(result)
1
t3_tqcsdg
1,648,483,853
Python
I made a Twitter bot that hates you!
I've messed around in Python on and off for a couple of years now. Most of what I've made has been exceptionally dumb (poorly written text adventures, a thing that used turtle to draw different colored spirals, a Garfield comic generator) and left unfinished. Until now! [Insult Ivan](https://twitter.com/InsultIvan) is a twitter bot I've created using Tweepy, and marks the first one of my exceptionally dumb projects to actually be done enough to function. All it does is pull words from four large lists (one with phrases to start the insult, and then three words to make up the insult itself), and then tweets this out once a day. It saves insults to a text file, so it won't repeat itself. It also responds to mentions with an insult that it will then only ever use for that user, reusing it in response to subsequent mentions from the same user. Anyway, the code is an absolute mess (I'm kind of assuming? I don't really know.), and I'm sure there is so much that I could have done better. But it functions and I love it and I wanted to share this beautifully idiotic thing I made. Code isn't available anywhere if that's okay (I can maybe mess around and see if I can make that happen if anyone really wants it). I'm happy to answer any questions though!
0.67
t3_tqc8pe
1,648,482,379
Python
PYTHON CERTIFICATIONS LIST - BEST OF 2022
[Python Certification](https://www.sprintzeal.com/blog/python-certifications) is an established general-purpose high-level programming language. It was established by Guido van Rossum in 1991, further developments were done by Python Software Foundation. The primary position in python is given to code readability. Because by using its syntax programmers will be able to create concepts with fewer lines of code.
0.17
t3_tqbfx0
1,648,480,156
Python
A roadmap of the free CS curriculum on Qvault (JS, Python, Go)
0.82
t3_tqaff4
1,648,477,395
Python
Feedback Requested - First Script that Calls API and Posts to MS Teams
Looking for feedback regarding my first script. Overall it calls a API, cleans the data a bit and then makes a post to MS Teams. https://imgur.com/a/5MkAsGu Anything I'm doing terrible? Something I could do better? More efficient?
0.5
t3_tq9d4k
1,648,474,241
Python
The counter-intuitive rise of Python in scientific computing
0.93
t3_tq8jzp
1,648,471,730
Python
X-Cash crypto now has a Python wrapper Library
0.23
t3_tq8csg
1,648,471,059
Python
PYTHON CERTIFICATIONS LIST - BEST OF 2022
Benefits of Python Certification Following are the benefits one would get through python certification, **Easy to learn** The key benefit of python certification is the programming language of python is easy to learn. **Python certification** can be used as a channel to a career, where learning other programming languages and frameworks will start to seem interesting. If one is a complete beginner and wants to learn about programming, python will help to start better. Python is a simple and easy-to-understand programming language. And once the course is completed and you get the python certification, you will be confident enough to explore more about the programming world. **Expertise in Python** When it comes to recruiting python programmers, recruiters always expect good skills and what is the unique skill that makes the candidate stand out from the rest of the crowd. **Python certification** will help in such situations, if you are one of the candidates applying for a position and you have a certificate you will have better chances to get selected. Hence, having [python certification](https://www.sprintzeal.com/blog/python-certifications) will prove that you know better and will help you gain the recruiter's interest.
1
t3_tq7crh
1,648,467,751
Python
py.quit it
0.35
t3_tq6wo3
1,648,465,973
Python
Scrape all Naver Video Results using pagination in Python
Using [`parsel`](https://parsel.readthedocs.io/): ```python import requests, json from parsel import Selector params = { "start": 0, # page number "display": "48", # videos to display. Hard limit. "query": "minecraft", # search query "where": "video", # Naver videos search engine "sort": "rel", # sorted as you would see in the browser "video_more": "1" # required to receive a JSON data } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36", } video_results = [] html = requests.get("https://s.search.naver.com/p/video/search.naver", params=params, headers=headers, timeout=30) json_data = json.loads(html.text.replace("( {", "{").replace("]})", "]}")) html_data = json_data["aData"] while params["start"] <= int(json_data["maxCount"]): for result in html_data: selector = Selector(result) for video in selector.css(".video_bx"): title = video.css(".text").xpath("normalize-space()").get().strip() link = video.css(".info_title::attr(href)").get() thumbnail = video.css(".thumb_area img::attr(src)").get() channel = video.css(".channel::text").get() origin = video.css(".origin::text").get() video_duration = video.css(".time::text").get() views = video.css(".desc_group .desc:nth-child(1)::text").get() date_published = video.css(".desc_group .desc:nth-child(2)::text").get() video_results.append({ "title": title, "link": link, "thumbnail": thumbnail, "channel": channel, "origin": origin, "video_duration": video_duration, "views": views, "date_published": date_published }) params["start"] += 48 html = requests.get("https://s.search.naver.com/p/video/search.naver", params=params, headers=headers, timeout=30) html_data = json.loads(html.text.replace("( {", "{").replace("]})", "]}"))["aData"] print(json.dumps(video_results, indent=2, ensure_ascii=False)) Output: [ { "title": "Minecraft : 🏰 How to build a Survival Castle Tower house", "link": "https://www.youtube.com/watch?v=iU-xjhgU2vQ", "thumbnail": "https://search.pstatic.net/common/?src=https%3A%2F%2Fi.ytimg.com%2Fvi%2FiU-xjhgU2vQ%2Fmqdefault.jpg&type=ac612_350", "channel": "소피 Sopypie", "origin": "Youtube", "video_duration": "25:27", "views": "126", "date_published": "1일 전" }, { "title": "조금 혼란스러울 수 있는 마인크래프트 [ Minecraft ASMR Tower ]", "link": "https://www.youtube.com/watch?v=y8x8oDAek_w", "thumbnail": "https://search.pstatic.net/common/?src=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fy8x8oDAek_w%2Fmqdefault.jpg&type=ac612_350", "channel": "세빈 XEBIN", "origin": "Youtube", "video_duration": "00:58", "views": "1,262", "date_published": "2021.11.13." } ] ``` Using [`playwright`](https://playwright.dev/python/) browser automation: ```python from playwright.sync_api import sync_playwright import json with sync_playwright() as p: browser = p.chromium.launch(headless=False) page = browser.new_page() page.goto("https://search.naver.com/search.naver?where=video&query=minecraft") video_results = [] not_reached_end = True while not_reached_end: page.evaluate("""let scrollingElement = (document.scrollingElement || document.body); scrollingElement.scrollTop = scrollingElement scrollHeight;""") if page.locator("#video_max_display").is_visible(): not_reached_end = False for index, video in enumerate(page.query_selector_all(".video_bx"), start=1): title = video.query_selector(".text").inner_text() link = video.query_selector(".info_title").get_attribute("href") thumbnail = video.query_selector(".thumb_area img").get_attribute("src") channel = None if video.query_selector(".channel") is None else video.query_selector(".channel").inner_text() origin = video.query_selector(".origin").inner_text() video_duration = video.query_selector(".time").inner_text() views = video.query_selector(".desc_group .desc:nth-child(1)").inner_text() date_published = None if video.query_selector(".desc_group .desc:nth-child(2)") is None else \ video.query_selector(".desc_group .desc:nth-child(2)").inner_text() video_results.append({ "position": index, "title": title, "link": link, "thumbnail": thumbnail, "channel": channel, "origin": origin, "video_duration": video_duration, "views": views, "date_published": date_published }) print(json.dumps(video_results, indent=2, ensure_ascii=False)) browser.close() ``` Output: ```json [ { "position": 1, "title": "Minecraft : 🏰 How to build a Survival Castle Tower house", "link": "https://www.youtube.com/watch?v=iU-xjhgU2vQ", "thumbnail": "https://search.pstatic.net/common/?src=https%3A%2F%2Fi.ytimg.com%2Fvi%2FiU-xjhgU2vQ%2Fmqdefault.jpg&type=ac612_350", "channel": "소피 Sopypie", "origin": "Youtube", "video_duration": "25:27", "views": "재생수126", "date_published": "20시간 전" }, { "position": 1008, "title": "Titanic [Minecraft] V3 | 타이타닉 [마인크래프트] V3", "link": "https://www.youtube.com/watch?v=K39joThAoC0", "thumbnail": "https://search.pstatic.net/common/?src=https%3A%2F%2Fi.ytimg.com%2Fvi%2FK39joThAoC0%2Fmqdefault.jpg&type=ac612_350", "channel": "나이아Naia", "origin": "Youtube", "video_duration": "02:40", "views": "재생수22", "date_published": "2021.11.11." } ] ``` If you need a more in-depth explanation, you can visit the blog post at SerpApi: https://serpapi.com/blog/scrape-all-naver-video-results-using-pagination-in-python/#full_code
0.4
t3_tq6vg2
1,648,465,829
Python
Open-source tool to make awesome-looking docs
[https://mkdocs-magicspace.alnoda.org/](https://mkdocs-magicspace.alnoda.org/) This is a free tool I made. It will help to make beautiful docs for any Python project, and host them on GitHub pages. Based on MkDocs, I extended it with lots of plugins and extensions. And created tutorials. I hope you find it useful.
0.82
t3_tq6sgn
1,648,465,502
Python
GitHub - enthought/traits: Observable typed attributes for Python classes
0.78
t3_tq4p5h
1,648,456,356
Python
Top python libraries/ frameworks that you suggest every one
Hit your answer I wonder is there any hidden treasure.
0.81
t3_tq483b
1,648,454,163
Python
Top 5 Python Time Series Libraries
0.75
t3_tq3cjf
1,648,450,342
Python
Master Python Comprehensions
Hi folks, Wrote something down about Python Comprehensions, focusing on simplicity and readability. You can have a look here [https://towardsdatascience.com/master-python-comprehensions-4ef1c66b452d](https://towardsdatascience.com/master-python-comprehensions-4ef1c66b452d) Happy to discuss :) Thanks!
0.75
t3_tq2ain
1,648,445,882
Python
a lightweight DNS traffic flow monitor
Hi, I wrote a lightweight DNS traffic query / response monitor by using Scapy. It will print each transaction per line. Here's the source code link: [https://github.com/meow-watermelon/dns-flow](https://github.com/meow-watermelon/dns-flow) I attached a screenshot to show the output example. Any suggestions are welcome. Thanks! https://preview.redd.it/8ky0mi6z02q81.png?width=2560&format=png&auto=webp&s=051e9591b484ff58d26eafd43b4ed3188faa7ba1
0.67
t3_tq1g8u
1,648,442,658
Python
What type of language is Python?
I use python in all my classes and got into a discussion with my students about what type of language python is. Initially, I thought python is a completely "non-typed" language because we are able to suppress types while declaring variables and parameters: *def func(a, b): ...* But then I found out that it's possible to type things up explicitly: *def func(a: int, b: int) -> int: ...* I ended up categorizing python as an "implicitly typed" language, and the interpreter must fill the types I don't explicitly add to the code. However, one of my students pointed out that, as python admits dynamic typing, it is a "dynamically typed language", which is the official classification (?). However, I have failed to wrap my mind around the fact that I can explicitly set the types, but the interpreter won't bat an eye in case I recast my variables: *def func(a: int, b: int) -> int:* *...c: int = a + b* *...return c* *d: int = func(1, 2)* *print(d)* *d = "dynamically typed?"* *print(d)* Is "weakly-typed dynamic language" a possible way to classify python?
0.63
t3_tpzl61
1,648,435,995
Python
List comprehension vs multiplying a list differences?
Is there any difference between the following code?: arr = [[]] * 10 arr = [[] for x in range(10)] I used the first method to initiate a list on a hackerank problem and I kept getting wrong answer. When I googled the answer and saw the person use the second method, so I tried it and got the right answer?? `[[]] * 10 == [[] for x in range(10)]` returns True. Why would the way I initiate this list cause a different result? If anyone wants to try it themselves.. it's a real head scratcher for me. [https://programs.programmingoneonone.com/2021/05/hackerrank-dynamic-array-solution.html](https://programs.programmingoneonone.com/2021/05/hackerrank-dynamic-array-solution.html) def dynamicArray(n, queries): # Write your code here arr = [[] for x in range(n)] #Now try using the code below to initiate arr. This fails it for me. #arr = [[]] * n lastAnswer = 0 answers = [] for x in queries: idx = (x[1]^lastAnswer) % n if x[0] == 1: arr[idx].append(x[2]) else: lastAnswer = arr[idx][x[2] % len(arr[idx])] answers.append(lastAnswer) return answers
0.59
t3_tpz8kn
1,648,434,777
Python
Monday Daily Thread: Project ideas!
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, ["The Big Book of Small Python Projects"](https://inventwithpython.com/bigbookpython/) which provides a list of projects and the code to make them work.
1
t3_tpwknx
1,648,425,608
Python
3D Render engine, written in 100% Python, No external libraries. *EPILEPSY WARNING*
EDIT: I have fixed the flickering issue! As long as you use the latest version there should be no flickering at all! Video of it running: [https://youtu.be/7J2Pn8me7m8](https://youtu.be/7J2Pn8me7m8) Github link: [https://github.com/E-Parker/Terminal-3D-Render/releases](https://github.com/E-Parker/Terminal-3D-Render/releases) I've been working on this for a little while, it's a simple 3D render engine that uses only the built-in python libraries. NOTE: If you suffer from any conditions that cause sensitivity to flashing lights do not use PREVIOUS versions of this program. The latest version is safe and free of flickering.Because the print command is very slow sometimes the screen will refresh before python is done drawing the frame, this causes the image to flicker occasionally. The effect worsens the faster your monitor's refresh rate is. The features of this version are:- BMP decoding \- OBJ decoding \- Perspective Texture mapping \- Depth buffer \- Simple directional lighting \- 231 colours! I don't think there is much to be learned from this other than how not to write a render engine, I spent a lot of time working out how to do things like decoding .bmp files when there are already solutions that are way faster and much less of a pain to work with. This was mostly an exercise to see how far I could go without any tools. Also, do keep in mind this is the 4th project I've made with python, I'm not super experienced so don't expect the code to be very good-looking.
0.93
t3_tpv7hs
1,648,421,114
Python
How did your coding style in python change after you learned another language?
Different languages make you write different code, but im curious if the way you wrote python changed due to coding in another language!
0.96
t3_tpu9p2
1,648,418,231
Python
Build signed .aab with Kivy, Buildozer for Google Play Store (Windows & ...
0.67
t3_tppdqx
1,648,404,134
Python
Made a Flask boilerplate using a services oriented structure
0.88
t3_tpp9y4
1,648,403,841
Python
Apilytics open-source middleware available for Flask! Install in 5 minutes and visualize all important metrics from your Flask backend
0.72
t3_tpntm0
1,648,399,539
Python
Actionable Notification with Callback in Python
0.81
t3_tpmfni
1,648,395,499
Python
Django 4 0 with Amazon RDS & Elastic Beanstalk Full Course
0.79
t3_tpky84
1,648,390,913
Python
Improved version of Al Sweigart's swordfish program
Yesterday, I worked on improving Al Sweigart's *swordfish* program to limit to three the attempts a user can input their name and password. I'm proud of my work, although I ran into several bugs which left me scratching my head for a while. A big Thank You to Al for writing such a good introduction to Python! https://preview.redd.it/lldmgux5nxp81.png?width=1494&format=png&auto=webp&s=1a881647b5ffd69fc9b2c921db059c636ca15d2b
0.64
t3_tpkr49
1,648,390,282
Python
Learn Blockchain Concepts Practically With Python
0.41
t3_tpjodl
1,648,386,792
Python
PYVAULT - PYVAULT is a python program with which you can secure your precious passwords very easily.
Hi guys. So, I have made a python script which can store your passwords in a database and you can encrypt it with a secret key which is generated by the script only. Actually, with this , we can store our passwords pretty securely until our key is exposed. So, I have used - i. sqlite3 (Used for database) ii. cryptograhy (To work with encryption and decryption using the key) These are the libraries. I used fernet to generate the key and to encrypt and decrypt the passwords and storing it in the database. The script provides a list of options - i. Create a database ii. Work with previous database iii. Generate key iv. Load key v. Retrive passwords You can see the code here - [https://github.com/Shreejan-35/PYVAULT/](https://github.com/Shreejan-35/PYVAULT/) All the contribution are welcome. I have done the project by learning from a video about password manager from a youtube channel - neuralnine. But, I worked with database and tried to take it to some advance steps. ​ Edit 1: Guys I have uploaded this as a package on [pypi.org](https://pypi.org) as vaulter-py. You can install it by typing - **pip install vaulter-py** ​ Thanks
0.4
t3_tpic7y
1,648,381,816
Python
python-nbxmpp 2.0.6 out!
0.6
t3_tpi6fh
1,648,381,174
Python
Backtesting A Put Option With An Example Of A Sell Put
Here's a simple post for people looking to try to backtest a put option strategy, or even a sell put strategy. I did this up because I was trying to look at a stock with a favorable put premium, and wanted to see based on a historical basis what are the chances of profit if I kept selling puts on these underlying at that premium [https://medium.com/@derivativestester/backtesting-a-vanilla-put-option-or-warrant-on-python-eec3ebaea5b](https://medium.com/@derivativestester/backtesting-a-vanilla-put-option-or-warrant-on-python-eec3ebaea5b) Hope that helps. Thanks.
0.87
t3_tpggqk
1,648,373,495
Python
I made a Python program that AUTOMATICALLY edits YouTube Videos!
https://youtu.be/WYiKb5Ggtjc
0.9
t3_tpgeiw
1,648,373,209
Python
I've created a extension for the Tornado framework that makes working with the framework easier and code development faster.
The extension is located in the [PyPi](https://pypi.org/project/usernado/) and you can easily install and use it. But the documentation and doc strings are not complete. This can be a good starting point if you want to [participate in open source](https://github.com/reganto/Usernado/issues). Install it via pip: `pip install usernado` Check it out here: [https://github.com/reganto/usernado](https://github.com/reganto/Usernado) Thank you for your attention.
0.74
t3_tpfzq3
1,648,371,196
Python
Using Python and Django, I've built to a GPT-3 powered web application to help myself write better
I am good in writing in my native language but when it comes to my second language, sometimes I struggle. So, for this reason, using Python and Django, I've built to a GPT-3 powered web application to help myself write better. I've been using it for a while and it is working so good! [https://www.youtube.com/watch?v=mfzW-LDajog](https://www.youtube.com/watch?v=mfzW-LDajog) Looking forward to your feedback. Best,
0.5
t3_tpb1qd
1,648,349,987
Python
I made my first gui program!
I finally made a gui using tkinter. Its a super simple program that takes in an image and then makes it into text art using the braille unicode characters. You can specify the final dimensions of the characters. Also you can control how sensitive it is. Seemed like a fun thing to try! Not many ive told have been interested or understood so I thought I should try here. [https://imgur.com/gallery/kMth4Cn](https://imgur.com/gallery/kMth4Cn) For those curious Ill explain my process I use tkinter to make a menu with all the settings and when you click generate it runs my image algorithm The algorithm is pretty simple and uses pillow Using pillow I get an image and convert it to black and white Then I use two for loops to go through the grid of data. It starts and the 0,0 pixel. It then grabs a 2 wide and 3 tall chunk of values. If the values are above the contrast value they are then set to a 1, else its a 0. Then I reorganize the list of values of a chunk into a binary number. This is because the unicode counts up in binary. So once i arrange all the numbers to their binary number. I just convert that number to the unicode character. Then i save that chunk to a list. I do this for ever chunk on that layer. It then moves down and repeats until we have a matrix of braille characters. Finally it just prints those arrays to a txt file The image kinda depends on how the text is displayed. On windows its inconsistent based on the zoom, certain levels of zoom cause distortions. Sorry if this didn't make sense I tried my best to explain for those interested. Thank you for reading!
0.84
t3_tpak0x
1,648,348,186
Python
Tools for designing hardware in Python
Any hardware designers here who use Python for designing hardware? There are a bunch of libraries that all seem promising [MyHDL](https://www.myhdl.org/), [PyRTL](https://github.com/UCSBarchlab/PyRTL), [PyVerilog](https://github.com/PyHDI/Pyverilog), [PyLog](https://github.com/hst10/pylog), [PyMTL3](https://github.com/pymtl/pymtl3), ... All seem to work roughly the same. Write code in Python and transpile it to VHDL/Verilog. Which of these are popular and well-maintained? MyHDL looks good but it's last release was 0.10 in 2018 and for hardware design you don't want to rely on 0.x software. Anything like Chisel for Python.
0.72
t3_tpa4eo
1,648,346,641
Python
Sunday Daily Thread: What's everyone working on this week?
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
1
t3_tp7ye1
1,648,339,210
Python
Live video to ascii
Hi! ​ First time posting, this is a small passion project which I coded in my free time. [https://github.com/DSERIOUSGUY/whoami.git](https://github.com/DSERIOUSGUY/whoami.git) It basically converts Image/live video to ascii art (can save as Image or text) using openCV. Currently it does not save video and only supports black/white and white/black coloring(my initial goal was to make it look a bit retro - if that makes any sense). I would love to hear your suggestions on how it could be improved on and what features could be added! Edit: Attached are samples of all modes (all are captured at different moments) ​ [Video](https://preview.redd.it/19cpror02tp81.png?width=602&format=png&auto=webp&s=dd17430640f30d8c886c6ff79b42551a95de7841) Since I don't really care about latency for an image, higher resolution is used as compared to video. [Image](https://preview.redd.it/f5ufsr6g2tp81.png?width=1920&format=png&auto=webp&s=c8a52f4e27abdba583f2001d535e16bc19b6c1f5) ​ A higher resolution image spreads out too much to be viewed as a picture, so had lower the resolution before writing the file [Text](https://preview.redd.it/9vb45izl2tp81.png?width=1920&format=png&auto=webp&s=ae36fb691f1ca9734b48cc3bdcc7ea36ae5f7f28)
0.78
t3_tp684n
1,648,333,884
Python
toolgui: A modular event-driven GUI system for quickly building tools with Python and pyimgui.
0.86
t3_tp50ru
1,648,331,504
Python
Arcade version 2.6.13 has been released
Arcade, a 2D graphics library, has released version 2.6.13. [https://api.arcade.academy/en/latest/development/release\_notes.html](https://api.arcade.academy/en/latest/development/release_notes.html) ​ * New Features * Arcade can now run in headless mode on linux servers **opening more possibilities for users in for example the data science** community ([\#1107](https://github.com/pythonarcade/arcade/issues/1107)). See [Headless Arcade](https://api.arcade.academy/en/latest/advanced/headless.html#headless) for more information. * Bugfixes * The random text glitching issue especially affecting users with iGPUs is finally resolved in pyglet. For that reason we have upgraded to the pyglet 2.0a2 release. * Fixed an issue causing [arcade.draw\_circle\_filled()](https://api.arcade.academy/en/latest/api/drawing_primitives.html#arcade.draw_circle_filled) and [arcade.draw\_circle\_outline()](https://api.arcade.academy/en/latest/api/drawing_primitives.html#arcade.draw_circle_outline) to always render with 3 segments on some iGPUs. * Fixed an issue causing interactive widgets to unnecessarily re-draw when hovering or pressing them. This could cause performance issues. * SectionManager’s on\_show\_view was never called when showing a view * Various Improvements * [arcade.load\_font()](https://api.arcade.academy/en/latest/api/text_pyglet.html#arcade.load_font) now supports resource handles * [PhysicsEngineSimple](https://api.arcade.academy/en/latest/api/physics_engines.html#arcade.PhysicsEngineSimple) can now take an iterable of wall spritelists * Sprite creation is now \~6-8% faster. * Removed warning about missing shapely on startup * Window titles are now optional. If no window title is specified the title will be the absolute path to the python file it was created in. This was changed because of the new headless mode. * Removed arcade.quick\_run . This function had no useful purpose. * Added clear method to UIManager ([\#1116](https://github.com/pythonarcade/arcade/pull/1116)) * Updated from Pillow 9.0.0 to 9.0.1 * Tilemap * Rectangle objects which are empty(have no width or height) will now be automatically converted into single points. * The Tile ID of a sprite can be access with sprite.properties\["tile\_id"\] . This refers to the local ID of the tile within the Tileset. This value can be used to get the tile info for a given Sprite created from loading a tilemap. * Docs * Added python version support info to install instructions ([\#1122](https://github.com/pythonarcade/arcade/pull/1122)) * Fixed typo in [append\_texture()](https://api.arcade.academy/en/latest/api/sprites.html#arcade.Sprite.append_texture) docstring([\#1126](https://github.com/pythonarcade/arcade/pull/1126)) * Improved the raycasting tutorial ([\#1124](https://github.com/pythonarcade/arcade/issues/1124)) * Replace mentions of 3.6 on Linux install page ([\#1129](https://github.com/pythonarcade/arcade/pull/1129)) * Fix broken links in the homepage ([\#1139](https://github.com/pythonarcade/arcade/pull/1130)) * Lots of other improvements to docstrings throughout the code base * General documentation improvements * OpenGL * [arcade.gl.Geometry](https://api.arcade.academy/en/latest/gl/geometry.html#arcade.gl.Geometry) now supports transforming to multiple buffers. * Added and improved examples in experimental/examples * Major improvements to API docs Special thanks to [Mohammad Ibrahim](https://github.com/Ibrahim2750mi), [pushfoo](https://github.com/pushfoo), [Alejandro Casanovas](https://github.com/janscas), [Maic Siemering](https://github.com/eruvanos), [Cleptomania](https://github.com/Cleptomania), [pvcraven](https://github.com/pvcraven) and [einarf](https://github.com/einarf) for their contributions to this release. Also, thanks to everyone on the Pyglet team! We depend heavily on Pyglet’s continued development.
0.88
t3_tp4o3d
1,648,330,422
Python
Why is Python so popular?
I am sorry if this is provocative to anyone, but personally I can't stand Python. I hate the indentations, Python is slow, no private keyword in OOP, dynamically typed ... Obviously I can see that it has its reasons to be popular in certain areas like data science. But why in the world in the backend for production level code? Please actually explain to me why you think Python is great from a software engineering perspective. I am coming from C# and simply cannot see any advantages in Python.
0.28
t3_tp3od4
1,648,327,393
Python
Space Science with Python - AI 1-9: A Convolutional Approach
Hey everyone, the asteroid reflectance spectra project reaches almost its end. There are 5 more videos to come and then I will focus on another topic (Near-Earth Objects). Anyway, spectra are still amazing and I show in today's session how to conduct an ML multi-class classification experiment using keras and Conv1D layers. You may thing: "well... creating a Deep Learning architecture is like magic". You are right. A few blueprints help one to get an idea how an architecture may look like. But improving e.g., the number of filters, layers, activations functions etc. is something that MUST be automatized. To tackle this, the next session will show "Keras Tuner" to automatize exactly this! Hope you still enjoy the combination of Space - Python - ML and I am looking forward to chat with you either here or on [Twitter](https://twitter.com/MrAstroThomas). GitHub: [https://github.com/ThomasAlbin/Astroniz-YT-Tutorials/blob/main/%5BML1%5D-Asteroid-Spectra/9\_dl\_convnet\_multiclass.ipynb](https://github.com/ThomasAlbin/Astroniz-YT-Tutorials/blob/main/%5BML1%5D-Asteroid-Spectra/9_dl_convnet_multiclass.ipynb) YouTube: [https://www.youtube.com/watch?v=648XF1o0B3c](https://www.youtube.com/watch?v=648XF1o0B3c) Cheers, Thomas
0.67
t3_tp0vo1
1,648,322,880
Python
Show r/python: Sailor - a tiny PaaS to install on your servers/VPS that uses git push to deploy micro-apps, micro-services, sites with SSL, on your own servers or VPS
Hey Pythonistas, here's a tool that I would like to share with y'all that allows you deploy multiple apps on servers/VPS. Let me know what you think and some feedback or what you would like to see in it. Introducing, Sailor. [https://github.com/mardix/sailor](https://github.com/mardix/sailor) **Sailor** is a tiny **PaaS** to install on your servers/VPS (DigitalOcean, Hetzner, Linode). It uses git push to deploy micro-apps, micro-services and sites. It natively supports Python, Nodejs, Static sites, and any other languages that can use the command line. Sites deployed with **Sailor** automatically have SSL assigned with LetsEncrypt. **Sailor** can run long-running background workers and cron jobs. It allows you to deploy multiple sites/apps using a single repository. It gives you the option of having testing/staging/production environment deployed from the same codebase. **Sailor** lets you see some stats about your apps, along with scaling them. **Sailor** makes deploying apps a smooth sailing. *Ship it like a* ***Sailor!*** [https://github.com/mardix/sailor](https://github.com/mardix/sailor)
0.67
t3_tozhrt
1,648,318,743
Python
Interview with a Postdoc, Junior Python Developer in 2022
0.93
t3_toy9gu
1,648,315,157
Python
What is the most pythonic way to limit while loop iterations?
Hi all Whenever I write a while loop, I always want to limit the number of iterations it can run to avoid infinite loops while developing the program, what would the most pythonic way of doing that? theres obviously the basic n = 0 while condition and n < 100: n += 1 but the `n+=1` can easily get lost or commented out when you are working on the code Ive also tried def count_generator(): n = 0 while True: yield n n += 1 counter = count_generator() while condition and next(counter) < 100: or class Counter: def __init__(self): self.count = 0 def inc(self): self.count += 1 return self.count counter = Counter() while condition and counter.inc() < 100: both of these feel like a lot of boiler plate for what should be a simple task, is there anything better?
0.8
t3_towbf7
1,648,311,909
Python
Image Processing With the Python Pillow Library – Real Python
0.82
t3_tov052
1,648,310,781
Python
oCrypt0r - AES encryption library
Hello everyone! I have decided to for the first time, try my hand at making an encryption package/library. It uses salted AES encryption. As of right now, I'm not sure what else to add to it or do as I have everything pretty much covered in terms of what could be encrypted. From just normal messages/strings to files and directories/folders. I hope you all like it or at least get some use out of it! Here is my github repo and PyPi link: - [GitHub - oCrypt0r](https://github.com/therealOri/oCrypt0r) - [PyPi - oCrypt0r](https://pypi.org/project/oCrypt0r/)
0.6
t3_tosyou
1,648,308,863
Python
PIPELY - new lightweight pipeline library
hey there, just released a new version of `pipely` \- a lightweight pipeline library that can trigger any sequence of classes in any order. # Simple Example: create `collect.yaml` steps: a1_print: exec: src/file1.py:firstA a2_print: exec: src/file1.py:secondA final_print: exec: src/file2.py:printDone depends_on: - a1_print - a2_print `depends_on` parameter sets the following order for pipely: 1. firstly it parallelly executes `firstA` and `secondA` classes (`a1_print` and `a2_print` steps) from file `src/file1.py` 2. and then executes `printDone` class (step `final_print`) from file `src/file2.py` It also allows **value transformations** between classes and other cool things. Check out [https://pypi.org/project/pipely/](https://pypi.org/project/pipely/) for more info, and let me know your feedback! This is just a pet project I had during my free lunch time :)
0.73
t3_tosvcq
1,648,308,584
Python
Simple Key Event Sending to an Application Wrapper I made
I made a Python library to send inputs to an executable, useful for scenarios such as having a neural network send decisions to a game. Essentially a wrapper around the win32api. You can send events to a window in just 2 lines: hwnd = pyinput.get_handle(window_name) # Gets the handle pyinput.press_key(hwnd, pyinputkeycodes.VK_RETURN) # Sends Return key I got annoyed at doing boilerplate over and over for this so I made a quick library! [https://github.com/GaryFrazier/PyInput](https://github.com/GaryFrazier/PyInput)
0.71
t3_toryjt
1,648,305,770
Python
Encrypto - A simple way of complicating/encrypting data
This is a repost I made to fit community guidelines. *Meet Encrypto, a revolutionary technology that can protect your data from the government **(Joke Intended)** and prevent the Feds from understanding your text.* The code itself does a simple task. When asked to encrypt data, it will generate two random keys. One till be used for the Caesar Cipher offset and the other defines how many times the symmetric algorithm is run. This will give out a gibberish looking string, which is then converted into a BrainF\*\*k *like* looking code. Wrong keys during decryption will give you the erroneous data. Note that since each character is encoded with 8-characters, and that the Base64 encryption happens multiple times, file size may skyrocket. I visualized this concept a long time ago, but spent some months completely understanding Python and the logic required (Encryption types, etc.). This code was designed to mimic the Enigma machine with its separate codes for different encryption types. Here's the link to the code: https://github.com/Programmer-X31/Encrypto.git Please give me your comments and give your ideas for what I should base the *third key* on.
0.68
t3_tonad8
1,648,296,993
Python
Creating mp4 clips with soccer data and Python
Hi Pythonistas! I’ve updated my package to allow users to creat mp4 clips of soccer data. Here is the short tutorial I wrote up on how to use it: https://todofootballclub.com/?p=1056. I’ve also run into an issue of wanting to use latitude and longitude data in the future but realized there is a learning curve with trans Mercator projections and other things to do it. I’m curious if anyone has ever started a project and realized ‘oh wow, there’s more to this than I thought’?
0.9
t3_tomsiv
1,648,295,093
Python
NiceScaler update 1.3.0
​ [GUI](https://preview.redd.it/gogk3hgavop81.png?width=2790&format=png&auto=webp&s=31396204dac0bb003f7ff7920a4c4555bf15109c) [example upscale](https://preview.redd.it/q9nwpoz8vop81.jpg?width=2486&format=pjpg&auto=webp&s=955eb9817ddc84a6d9392b00cf67d11b35577253) Itch -> [https://jangystudio.itch.io/nicescaler](https://jangystudio.itch.io/nicescaler) Github -> [https://github.com/Djdefrag/NiceScaler/releases/tag/1.3.0](https://github.com/Djdefrag/NiceScaler/releases/tag/1.3.0) ​ update 1.3.0 (26.03.2022) OpenCL backend / UX improvement / Speed improvement New feature * GPU OpenCL backend (to use GPU horsepower to upscale) * support for more images and video file types Improvements * updated Python (3.7.9 -> 3.9.10) * bugfix in AI model creation (speed boost \~10% with all models) * deleted EDSR model (lighter .exe 110Mb -> 70Mb) * general code cleanup UX * deleted EDSR model button * new colors for left bar * new button to select OpenCL backend * removed AI models info under buttons * removed NiceScaler icon * added Github button * drag&drop space cleaning
0.94
t3_tok71u
1,648,283,523
Python
The Oregon Trail
How many have ever played The Oregon Trail? I remember playing it in my later days of High School. Not the video game but the teletype version. I just ported over the original version from Fortran to Python. If you want to read out the different parts of the port or even get the source here are some links: [https://keithmfoster.com/the-oregon-trail/](https://keithmfoster.com/the-oregon-trail/) [Github Repository](https://github.com/KeithMFoster/the-oregon-trail) Happy Trails.
0.93
t3_toa6c6
1,648,256,653
Python
Saturday Daily Thread: Resource Request and Sharing! Daily Thread
Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic? Use this thread to chat about and share Python resources!
0.75
t3_to8lbi
1,648,252,810
Python
What's the dumbest, trivial, shoddily-written project you've made that somehow impressed a non-programmer?
I wrote a script that grabs an Overwatch screenshot, tries to recognize whatever hero portraits are present on the tab screen, then copies some text making hero suggestions into your clipboard. I'm 90% certain that the one person in the hiring process that sounded impressed when I mentioned it didn't actually look at it, because I got hired to try automating website tests with Selenium. (Note: I've long since taken this script down as it's in kind of a grey area with Blizzard's TOS)
0.93
t3_to8jhz
1,648,252,736
Python
AI Project Ideas
Hi everyone, I need to make an AI project with full-fledged programming ... it has to be based on a social issue nd focused mainly on the data science domain. Does anyone have any suggestions for an idea that can be implemented using AI? I'm open to anything as it's a group project and we're mainly putting forth any ideas right now at the start and will start ruling out to a final within a few days
0.82
t3_to33to
1,648,246,367
Python
pointers.py - segmentation faults in python
0.67
t3_tnz5uw
1,648,242,515
Python
Kids Learn to Code in Python with the Raspberry Pi Foundation
0.85
t3_tnw8zx
1,648,234,236
Python
I've built a wrapper that makes building Telegram Bots a lot easier
It's called **MATE** (*Easy Telegram Application Maker*, but reversed lol) and it automatically handles the boring under the hood stuff, letting you focus on the logic of your app. It comes with (fairly) complete **documentation** & a **PyPI** release. check it out here: [https://github.com/SudoOmbro/MATE](https://github.com/SudoOmbro/MATE) Tell me what you think! Thank you for your time :\^)
0.81
t3_tnsarp
1,648,229,199
Python
I Made a Hangman Game with Music, Light Artwork, and Sound Effects (GitHub Repo Below)
As my first python project, I decided to create a hangman game with music, light artwork, and sound effects. After completing PY4E on Coursera, I decided to create a program that combined all elements from the course. In all, it uses urllib for web scraping, sqlite3 to create and manage the leaderboard and wordbank, colorama for color, and playsound for sound. There are also "Classic" and "Hardcore" modes. Classic operates as hangman traditionally works, and hardcore mode gives the user 8 seconds for input before subtracting a life and adding a part to the hangman. I started python in January, and it feels great to have actually created something! Here is the Github link: [https://github.com/DaSaltyPancake/Hangman.git](https://github.com/DaSaltyPancake/Hangman.git)
0.89
t3_tns9go
1,648,229,099
Python
A free and flexible translation library in python
Hi y all, *I'm not making this post only to promote the project. I also want to invite contributors and get feedback.* Feel free to check the GitHub [repo here](https://github.com/nidhaloff/deep-translator) deep-translator is a flexible and **free** translation library that supports multiple translators. I tried to make the API as consistent as possible so that it can be updated easily in the future. We fixed some bugs and added new features in the new releases. Since I don't have much time, I'm looking for maintainers & contributors, who want to join the project. Feel free to contact me if you are interested. You don't have to be a python professional, I want to help people make their first contribution and join the open-source world.
0.83
t3_tnp85j
1,648,224,421
Python
GitHub - Rog3rSm1th/Frelatage: The Python Fuzzer that the world deserves
0.43
t3_tnovr2
1,648,223,456