sub
stringclasses 4
values | title
stringlengths 3
304
| selftext
stringlengths 3
30k
| upvote_ratio
float64 0.07
1
| id
stringlengths 9
9
| created_utc
float64 1.6B
1.65B
|
---|---|---|---|---|---|
Python
|
Python Selenium Tutorial #8 - Read, Block & Mock Requests using Selenium Wire
|
nan
| 0.89 |
t3_u0c8yx
| 1,649,574,107 |
Python
|
Desktop stereo system made with Python
|
​
https://reddit.com/link/u0c60e/video/fawvxu65gns81/player
I absolutely love music, especially when coding. For a while now, I've been wanting to have a stound graphical analyzer to make y coding sessions more fun, so I decided to make my own. Here's the [code](https://github.com/BrickSigma/Desktop-stereo). I haven't documented the code yet or added any README file to it, but I will soon.
This was a lot of fun to make because I learnt a lot of new things about digital audio processing, like their format, and Fourier transformations, which I'm in love with now. This was also my first attempt at editing a video for public presentation, so I hope I've done justice to it.
Thanks for reading and have an amazing day!
| 0.85 |
t3_u0c60e
| 1,649,573,774 |
Python
|
Short Rock, Paper, Scissors game.
|
What do you thin about it, can it get any shorter?
[https://github.com/sat1ss/The-shortest-Rock-Paper-Scissors-game](https://github.com/sat1ss/The-shortest-Rock-Paper-Scissors-game)
| 0.71 |
t3_u0byeh
| 1,649,572,827 |
Python
|
r/AskScience flair classifier using Praw and Fasttext
|
I wanted to learn how to use get data from reddit and came across the praw library, so I decided to create a fasttext nlp model which classifies what flair a post should be on r/AskScience (because they have purely text posts and each question is flaired). Currently it works with the top 10 flairs, but I plan to add some improvements to it later on to include all flairs and perhaps other subreddits too.
link: [https://github.com/arnavkartikeya/RedditFlairClassifier](https://github.com/arnavkartikeya/RedditFlairClassifier)
| 0.75 |
t3_u085ro
| 1,649,557,796 |
Python
|
HiQ - A Modern Observability System
|
HiQ([https://github.com/oracle-samples/hiq](https://github.com/oracle-samples/hiq)) is a declarative, non-intrusive, dynamic and transparent tracking system for both monolithic application and distributed system. It brings the runtime information tracking and optimization to a new level without compromising with speed and system performance, or hiding any tracking overhead information. HiQ applies for both I/O bound and CPU bound applications.
To explain the four features, declarative means you can declare the things you want to track in a text file, which could be a JSON, YAML or even CSV, and no need to change program code. Non-intrusive means HiQ doesn’t requires to modify original python code. Dynamic means HiQ supports tracing metrics featuring at run time, which can be used for adaptive tracing. Transparent means HiQ provides the tracing overhead and doesn’t hide it no matter it is huge or tiny.
In addition to latency tracking, HiQ provides memory, disk I/O and Network I/O tracking out of the box. The output can be saved in form of normal line by line log file, or HiQ tree, or span graph.
## Installation
pip install hiq-python
## Documentation
**HTML**: 📷[ HiQ Online Documents](https://hiq.readthedocs.io/en/latest/index.html)
**PDF**: Please check 📷[ HiQ User Guide](https://github.com/oracle-samples/hiq/blob/main/hiq/docs/hiq.pdf).
## Jupyter NoteBook
### Add Observability to PaddleOCR
* [Latency](https://github.com/oracle-samples/hiq/blob/henry_dev/hiq/examples/paddle/demo.ipynb)
* [Memory](https://github.com/oracle-samples/hiq/blob/main/hiq/examples/paddle/demo_memory.ipynb)
### Add Observability to AlexNet
* [Latency](https://github.com/oracle-samples/hiq/blob/main/hiq/examples/onnxruntime/demo.ipynb)
* [Intrusive](https://github.com/oracle-samples/hiq/blob/main/hiq/examples/onnxruntime/demo_intrusive.ipynb)
## Examples
Please check 📷[ examples](https://github.com/oracle-samples/hiq/blob/main/hiq/examples) for usage examples.
| 0.83 |
t3_u07er0
| 1,649,555,126 |
Python
|
Have/do any of you make a side hustle web scraping/procuring data with Python? Everyone that talks about it online in tandem with “make $ with Python” never says how much they made made doing this.
|
nan
| 0.81 |
t3_u06k0b
| 1,649,552,099 |
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.
| 0.89 |
t3_u05lzc
| 1,649,548,811 |
Python
|
What nontechnical piece of advice have you received that has changed how you work as a developer?
|
For example, Ive heard before automating something, you shouldn’t ask yourself if it can be done but should it be done.
It’s an intuitive, slap your forehead concept but one that was eye opening
| 0.89 |
t3_u0431h
| 1,649,543,792 |
Python
|
Tips for Python debugging in Vim
|
What is your workflow and which plugins do you use, if any ?
| 0.75 |
t3_u03d4y
| 1,649,541,591 |
Python
|
An easy to use PGP tool
|
Good morning to everyone, after my unsuccessful attempts at using PGP software, I decided to create my own one in python, as simple as I possibly could, to make it easier on myself should I ever need to use again this PGP process or should someone decide to use it.
I'm a student, an amateur python programmer and I love challenges, so I took upon the challenge of creating my first tool with a GUI, it's my first time using any of these python libraries and posting anything publicly....
I give you [EZPZ-PGP](https://github.com/HandImpersonator/EZPZ-PGP) (name could do some work, I know):
[Tool menu](https://preview.redd.it/equy9g1wjks81.png?width=322&format=png&auto=webp&s=ef57c2ce60e7c20edb4fb4f7a65dc2ee6993b4c4)
[Folders created](https://preview.redd.it/nxec6ovyjks81.png?width=887&format=png&auto=webp&s=27d55d3a47f937a9a2c18f26567293e16cb2c0ec)
[Key location](https://preview.redd.it/4ywhr3n0kks81.png?width=885&format=png&auto=webp&s=6979992268aa7458c90f4ac08abbc948387d54da)
[Message encryption test](https://preview.redd.it/x2pe8gb2kks81.png?width=479&format=png&auto=webp&s=74224b5cc3766fa1444e7e2d831279bda143de9d)
[Message decryption test](https://preview.redd.it/364ye2n5kks81.png?width=479&format=png&auto=webp&s=71385a74a8eee2463031ace4c578f3b6b7d83a15)
I really have no idea how much simpler to make this tool, I have included some [mildly straightforward instructions](https://github.com/HandImpersonator/EZPZ-PGP#what-the-tool-can-do) for ease of use. It can create PGP keypairs (PGPY), encrypt, decrypt, sign and verify signatures on messages and files (PGPY).
Completely open source, I want to share my personal tool with the world with the hope of getting some feedback on it and see if people like it a bit.
I'd like to work on translating the tool to other languages with latin alphabet, I'll upload soon to github a file with all the text needed to be translated to other languages. PM me if you decided to help translate the tool to your language so I can update the tool and include your name/account in the github credits!
​
Thank you, looking forward to your feedback.
| 0.82 |
t3_u02g7d
| 1,649,538,795 |
Python
|
I released a game made with Pygame!
|
Over the past week I challenged myself to make a game in Pygame and this was the result. Everything was made by me except the music!
https://i.redd.it/kp5kik7kdks81.gif
Download the game here - [https://scriptline-studios.itch.io/planyt](https://scriptline-studios.itch.io/planyt)
| 0.96 |
t3_u01qvx
| 1,649,536,656 |
Python
|
[Challenge] print "Hello World" without using W and numbers in your code
|
To be more accurate: without using w/W, **'** (apostrophe) and numbers.
Edit: try to avoid "ord", there are other cool tricks
[https://platform.interway.ai/#/get/play\_/ch/hello\_\[w09\]orld](https://platform.interway.ai/#/get/play_/ch/hello_[w09]orld)
Disclaimer: I built it, and I plan to write a post with the most creative python solutions
| 0.9 |
t3_u01kmr
| 1,649,536,115 |
Python
|
Threading in Python: The Complete Guide
|
nan
| 0.81 |
t3_u01bcj
| 1,649,535,326 |
Python
|
Has anyone applied to a job that requires a bachelors degree but doesn’t have one themselves and got the job??
|
I’m 22 years old and have an associates right now, I’m working on by bachelors but I HATE SCHOOL.
I have been learning python for a couple of months now an have a general understanding of it. I was just looking at entry level job and most of these require a bachelors degree, I really want to know if anyone has gotten any of those jobs without a bachelors??
| 0.79 |
t3_u00pmy
| 1,649,533,491 |
Python
|
How to correctly install Python applications & libraries from PyPI
|
nan
| 0.54 |
t3_tzyv6j
| 1,649,527,919 |
Python
|
Using Nuitka to Speed Python Code
|
I am playing with Nuitka and following this [link](https://ao.ms/how-to-package-a-python-app-using-nuitka/). I was under the impression that compiled program should run faster but that is not the case here?
Running the Python code,
$ time python test1.py
h<z`3C337E|$Oe2@
real 0m0.095s
user 0m0.024s
sys 0m0.013s
Then running the standalone code compiled via Nuitka,
$ time ./test1.bin
+>PAGZ$OHlVK/.5
real 0m0.191s
user 0m0.031s
sys 0m0.014s
The standalone code runs slower but shouldn't it have run faster since it is a complied?
| 0.6 |
t3_tzy00o
| 1,649,525,369 |
Python
|
Open Source Rhythmic Midi Generator for all Major Keys in Python
|
This program uses some relatively simple python logic to generate random chord progressions in every major key! The progressions are then broken up into rhythmic subunits, which are also semi-random.
The midi files need a specified directory to be outputted to. Where to do this can be found within the code.
Any and all feedback is appreciated!
Link to the code: [https://github.com/prod-emdub/midirhythm/tree/main](https://github.com/prod-emdub/midirhythm/tree/main)
&#x200B;
Here is an example of a randomly generated progression in F major:
&#x200B;
https://preview.redd.it/usbt91cd5js81.png?width=3541&format=png&auto=webp&s=eb5513343eb5bccf4bdda2ad40eac07ba1355af6
| 0.91 |
t3_tzwra2
| 1,649,521,697 |
Python
|
Build a Site Connectivity Checker in Python – Real Python
|
nan
| 1 |
t3_tzwhkh
| 1,649,520,902 |
Python
|
I made an R6 Strat Roulette discord bot in python!
|
Hey I'm fairly new to python this is one of my first actual projects! If you want to talk to me about it or give me some suggestions add me on discord: Axkkzy#7992 :)
[https://github.com/Axkkzy/R6-Strat-Roulette-Bot](https://github.com/Axkkzy/R6-Strat-Roulette-Bot)
| 0.83 |
t3_tzulmw
| 1,649,515,365 |
Python
|
Free Python Course Inquiry
|
I had a quick question regarding a coursera class I am currently taking for simple python programming (it's offered for free and it looks like the course is laid out fairly well).
However, after week 1 (so a few hours I've invested), it appears to be a course that may have been recycled/offered to newbies from original posting date of several years ago and not within the past 2 years (I found comments from students reviewing the course from 2016).
The teaching style is a little inflexible at times (jumping around functions, assignments a bit), but I want to get through the course because of the value of learning to work with Python
Is there value in this particular program based on the age of the course or do I need to restart a similar course not older than a certain amount of years? They are working with python 3.4 btw
&#x200B;
Thanks for any feedback/recommendations!
| 0.33 |
t3_tzra4g
| 1,649,503,690 |
Python
|
Python client for Crunchbase's REST API
|
Hi, I recently needed to use [Crunchbase](https://www.crunchbase.com/)'s REST API in a project but couldn't find a well-maintained python client for it. I started writing one and decided to open-source it. This is my first open-sourced project. Your feedback, improvements, and suggestions will be appreciated.
[https://pypi.org/project/py-crunchbase-api/](https://pypi.org/project/py-crunchbase-api/)
Thanks.
| 1 |
t3_tzq3q7
| 1,649,498,486 |
Python
|
What do you guys think of this book?
|
nan
| 0.87 |
t3_tzpk9y
| 1,649,496,037 |
Python
|
custom-literals A module implementing custom literal suffixes using pure Python
|
nan
| 1 |
t3_tzp8qe
| 1,649,494,611 |
Python
|
Python — Network Tracking using Wireshark and Google Maps
|
nan
| 0.91 |
t3_tzp4n9
| 1,649,494,069 |
Python
|
A Hitomezashi pattern generator I made in python!
|
I made a Hitomezashi stitch pattern generator fully in python after watching the Numberphile video a long time ago. I used the pygame module to do it.
Source Code- [https://github.com/Topkinsme/Hitomezashi-Stitch-Pattern-Generator/blob/main/main.py](https://github.com/Topkinsme/Hitomezashi-Stitch-Pattern-Generator/blob/main/main.py)
https://reddit.com/link/tzp0f4/video/sorpps5wsgs81/player
| 0.97 |
t3_tzp0f4
| 1,649,493,503 |
Python
|
When default __new__ function should be overwritten?
|
I recently learnt about diffrence beetween __new__ and __init__ functions, but I cannot find usecase of writing my own __new__ method.
| 0.83 |
t3_tzmyvu
| 1,649,484,444 |
Python
|
Pygame Tutorial - Menus and Buttons!
|
nan
| 0.4 |
t3_tzjdxt
| 1,649,471,029 |
Python
|
Internship skills:
|
I’m pretty new to python. All i’ve done is take a dual enrollment class at gt for it and the farthest we covered in the course is project oriented learning. I understand how to do the basic problems in the class like given an array of movies and their gross profit, sort them from greatest profit to least profit. Simple things like that. What can i do to learn how to actually apply this stuff to the point that i would be useful in an internship??
| 0.75 |
t3_tzh04s
| 1,649,462,928 |
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_tzgu3e
| 1,649,462,409 |
Python
|
Shortening common parts of code
|
Title.
In JavaScript there are things like the ternary operator to reduce code size and "improve" code quality, I'm wondering if there is much in python aside from the obvious which is lambda
| 0.5 |
t3_tze4s6
| 1,649,454,239 |
Python
|
I created a library for teacher task automation
|
I created a library of utilities I've used as a teacher to automate various tasks (mail merges, interacting with google classroom, generating rubrics). I hope that it might lower the barrier of entry for teachers with some python knowledge to get started with using programming to ease the repetitive aspects of our work.
Comments, criticism, and code review are much appreciated!
https://pypi.org/project/teacherhelper/
https://teacherhelper.jackdevries.com/
https://github.com/jdevries3133/teacher_helper
| 0.94 |
t3_tzb9yc
| 1,649,446,042 |
Python
|
Using Github to host local images permenently on the web.
|
When you create an issue or add an image on github, you can actually upload images to the github server without any external apis. We can use this feature to mimic Github's behavior when uploading an image and upload any local image to the web. Because github has to store all images permenently (or images on READMEs or issues could change), we also do not have to worry about uploaded images expiring.
I have been using this feature (although not automatically) for a long time to host images for my own website, and finally managed to automate this process.
Honestly, as a beginner in programming, hosting images for websites for free is a pain in the ass and I hope this will help people learn more about websites.
[Github link](https://github.com/0ev/github-issue-image-upload)
| 0.38 |
t3_tzb541
| 1,649,445,662 |
Python
|
Wordle in command line
|
you can wide the dictionary if you want 😉
from os import system, name
import re
import random
# define our clear function
def clear():
if name == 'nt': # for windows
system('cls')
else: # for mac and linux(here, os.name is 'posix')
system('clear')
#show the rules of the game and descripcion
def menu():
print("""
__ __ _ _ ____
\ \ / /__ _ __ __| | | ___ / ___| __ _ _ __ ___ ___
\ \ /\ / / _ \| '__/ _` | |/ _ \ | | _ / _` | '_ ` _ \ / _ \\
\ V V / (_) | | | (_| | | __/ | |_| | (_| | | | | | | __/
\_/\_/ \___/|_| \__,_|_|\___| \____|\__,_|_| |_| |_|\___|
Try to guess the word, we lend you some clues when you assert.
After each guess, the color of the tiles will change to show how close your guess was to the word
""")
def show_words(array_words,guessword):
for word in array_words:
list_blocks = ""
for i,letter in enumerate(word):
if letter in guessword:
if word[i] == guessword[i]:
block = "🟩"
else:
block = "🟨"
else:
block = "🔲"
list_blocks += block
print(word.replace("", " ")[1: -1])
print(list_blocks)
if __name__ == "__main__":
dictionary = ["ninja","great","witch","grown","space","stone","earth","extra","entry","slice","shine","sharp","eager","ebony","penny"]
guessword = random.choice(dictionary)
lenword = len(guessword)
word_guessed = False
array_words = []
while word_guessed == False:
clear()
menu()
show_words(array_words,guessword)
try:
word = input(f"Hit some word of {lenword} length here:")
if len(word) != lenword:
raise ValueError(f"it must be {lenword} length word!")
elif not re.search(r"[a-zA-Z]{"+str(lenword)+"}",word):
raise ValueError(f"it must be only alfabetical characters!")
elif word == guessword:
print(word.replace("", " ")[1: -1])
print("🟩🟩🟩🟩🟩")
print("Awesome! 🎉🎉🎉")
word_guessed = True
else:
array_words.append(word)
except ValueError as e:
print(e)
a = input("Press 'enter' to continue")
| 0.46 |
t3_tz8uhj
| 1,649,439,253 |
Python
|
so im 30 switching careers from automotive to computers started college for computer science learning python 3 but i feel its going kinda slow learning so much though so i figured I would ask the more knowledgeable people on what i can do in my free time to grow my knowledge more
|
nan
| 0.68 |
t3_tz7tcm
| 1,649,436,416 |
Python
|
Preferred way to connect to a database
|
Is it a particular ORM, do you use a particular ODBC library, embracing the bleeding edge of speed with Apache Arrow?
What satisfies your data source access needs and why?
| 0.78 |
t3_tz7aj5
| 1,649,434,965 |
Python
|
Unix Command Cheat Sheet for Busy Developers
|
nan
| 0.67 |
t3_tz62m7
| 1,649,431,679 |
Python
|
Scrape Google Play Search Apps in Python
|
Hey guys, just in case anyone wants to scrape Google Play Store App Search 👀
Full code:
```python
from bs4 import BeautifulSoup
from serpapi import GoogleSearch
import requests, json, lxml, re, os
def bs4_scrape_all_google_play_store_search_apps(
query: str,
filter_by: str = "apps",
country: str = "US"):
# https://docs.python-requests.org/en/master/user/quickstart/#passing-parameters-in-urls
params = {
"q": query, # search query
"gl": country, # country of the search. Different country display different apps.
"c": filter_by # filter to display list of apps. Other filters: apps, books, movies
}
# https://docs.python-requests.org/en/master/user/quickstart/#custom-headers
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.79 Safari/537.36",
}
html = requests.get("https://play.google.com/store/search", params=params, headers=headers, timeout=30)
soup = BeautifulSoup(html.text, "lxml")
apps_data = []
for app in soup.select(".mpg5gc"):
title = app.select_one(".nnK0zc").text
company = app.select_one(".b8cIId.KoLSrc").text
description = app.select_one(".b8cIId.f5NCO a").text
app_link = f'https://play.google.com{app.select_one(".b8cIId.Q9MA7b a")["href"]}'
developer_link = f'https://play.google.com{app.select_one(".b8cIId.KoLSrc a")["href"]}'
app_id = app.select_one(".b8cIId a")["href"].split("id=")[1]
developer_id = app.select_one(".b8cIId.KoLSrc a")["href"].split("id=")[1]
try:
# https://regex101.com/r/SZLPRp/1
rating = re.search(r"\d{1}\.\d{1}", app.select_one(".pf5lIe div[role=img]")["aria-label"]).group()
except:
rating = None
thumbnail = app.select_one(".yNWQ8e img")["data-src"]
apps_data.append({
"title": title,
"company": company,
"description": description,
"rating": float(rating) if rating else rating, # float if rating is not None else rating or None
"app_link": app_link,
"developer_link": developer_link,
"app_id": app_id,
"developer_id": developer_id,
"thumbnail": thumbnail
})
print(json.dumps(apps_data, indent=2, ensure_ascii=False))
bs4_scrape_all_google_play_store_search_apps(query="maps", filter_by="apps", country="US")
def serpapi_scrape_all_google_play_store_apps():
params = {
"api_key": os.getenv("API_KEY"), # your serpapi api key
"engine": "google_play", # search engine
"hl": "en", # language
"store": "apps", # apps search
"gl": "us", # contry to search from. Different country displays different.
"q": "maps" # search qeury
}
search = GoogleSearch(params) # where data extracts
results = search.get_dict() # JSON -> Python dictionary
apps_data = []
for apps in results["organic_results"]:
for app in apps["items"]:
apps_data.append({
"title": app.get("title"),
"link": app.get("link"),
"description": app.get("description"),
"product_id": app.get("product_id"),
"rating": app.get("rating"),
"thumbnail": app.get("thumbnail"),
})
print(json.dumps(apps_data, indent=2, ensure_ascii=False))
```
Output from DIY solution:
```json
[
{
"title": "Google Maps",
"company": "Google LLC",
"description": "Real-time GPS navigation & local suggestions for food, events, & activities",
"rating": 3.9,
"app_link": "https://play.google.com/store/apps/details?id=com.google.android.apps.maps",
"developer_link": "https://play.google.com/store/apps/dev?id=5700313618786177705",
"app_id": "com.google.android.apps.maps",
"developer_id": "5700313618786177705",
"thumbnail": "https://play-lh.googleusercontent.com/Kf8WTct65hFJxBUDm5E-EpYsiDoLQiGGbnuyP6HBNax43YShXti9THPon1YKB6zPYpA=s128-rw"
},
{
"title": "Google Maps Go",
"company": "Google LLC",
"description": "Get real-time traffic, directions, search and find places",
"rating": 4.3,
"app_link": "https://play.google.com/store/apps/details?id=com.google.android.apps.mapslite",
"developer_link": "https://play.google.com/store/apps/dev?id=5700313618786177705",
"app_id": "com.google.android.apps.mapslite",
"developer_id": "5700313618786177705",
"thumbnail": "https://play-lh.googleusercontent.com/0uRNRSe4iS6nhvfbBcoScHcBTx1PMmxkCx8rrEsI2UQcQeZ5ByKz8fkhwRqR3vttOg=s128-rw"
},
{
"title": "Waze - GPS, Maps, Traffic Alerts & Live Navigation",
"company": "Waze",
"description": "Save time on every drive. Waze tells you about traffic, police, crashes & more",
"rating": 4.4,
"app_link": "https://play.google.com/store/apps/details?id=com.waze",
"developer_link": "https://play.google.com/store/apps/developer?id=Waze",
"app_id": "com.waze",
"developer_id": "Waze",
"thumbnail": "https://play-lh.googleusercontent.com/muSOyE55_Ra26XXx2IiGYqXduq7RchMhosFlWGc7wCS4I1iQXb7BAnnjEYzqcUYa5oo=s128-rw"
}, ... other results
]
```
Full blog post with step-by-step explanation: https://serpapi.com/blog/scrape-google-play-search-apps-in-python/
| 0.8 |
t3_tz621l
| 1,649,431,634 |
Python
|
Rock-Paper-Scissors-Lizard-Spock Game
|
from random import randint
# create a list of play options
options = ["Rock", "Paper", "Scissors", "Lizard", "Spock"]
play = True
while play == True:
computer = options[randint(0, 4)]
user_input = input("Please select; Rock, Paper, Scissors, Lizard or Spock\n")
u = user_input.lower()
player = u.capitalize()
print("Player: ", player)
print("Computer: ", computer)
##Tie
if player == computer:
print("Tie!")
##Rock
elif player =="Rock":
if computer == "Paper":
print("You lose!", computer, "covers", player)
elif computer == "Scissors":
print("You win!", player, "smashes", computer)
elif computer == "Lizard":
print("You win!", player, "crushes", computer)
elif computer == "Spock":
print("You lose!", computer, "vaporizes", player)
##Paper
elif player =="Paper":
if computer == "Scissors":
print("You lose!", computer, "cuts", player)
elif computer =="Rock":
print("You win!", player, "covers", computer)
elif computer == "Lizard":
print("You lose!", computer , "eats", player)
elif computer == "Spock":
print("You win!", player, "disproves", computer)
##Scissors
elif player == "Scissors":
if computer == "Paper":
print("You win!", player, "cuts", computer)
elif computer == "Rock":
print("You lose!", computer, "crushes", player)
elif computer =="Lizard":
print("You win!", player, "decapitates", computer)
elif computer == "Spock":
print("You lose!", computer, "smashes", player)
##Lizard
elif player == "Lizard":
if computer =="Rock":
print("You lose!", computer, "crushes", player)
elif computer =="Paper":
print("You win!", player, "eats", computer)
elif computer == "Scissors":
print("You lose!", computer, "decapitates", player)
elif computer == "Spock":
print("You win!", player, "", computer)
##Spock
elif player == "Spock":
if computer == "Rock":
print("You win!", player, "vaporizes", computer)
elif computer == "Paper":
print("You lose!", computer, "disproves", player)
elif computer == "Scissors":
print("You win!", player, "smashes", computer)
elif computer == "Lizard":
print("You lose!", computer, "poisons", player)
print("Would you like to play again? \n")
answer =input()
if answer.lower() =="y" or answer.lower() =="yes":
play == True
else:
break
&#x200B;
&#x200B;
This is a game I made a while back, link; [https://github.com/WillPhillipsCVdemo/Rock-Paper-Scissors-Lizard-Spock/blob/master/Game.py](https://github.com/WillPhillipsCVdemo/Rock-Paper-Scissors-Lizard-Spock/blob/master/Game.py)
| 0.73 |
t3_tz41db
| 1,649,425,971 |
Python
|
MicroPython pro-tip: Use WebREPL within your IDE
|
The repetitive process of editing your code in Thonny IDE, switching over to the WebREPL window, re-selecting your edited code file, re-sending it to your ESP32, and going back to Thonny to fix any bugs can get cumbersome and slow.
Here's a visual tutorial on how to use WebREPL within Thonny. Hope it helps you!
[https://bhave.sh/micropython-webrepl-thonny/](https://bhave.sh/micropython-webrepl-thonny/)
| 0.5 |
t3_tz3knl
| 1,649,424,548 |
Python
|
br4nch 2.0 - Currently in development!
|
After recieving alot of helpful feedback and feature requests, I have decided to start the development of version 2.0 for br4nch!
*Please visit:* [*https://br4nch.com*](https://br4nch.com) *for helpful links.*
&#x200B;
**Here are some of the upcoming features:**
* Renewing alot of arguments and crucial functions. ⚠️
* Adding a new 'load.json' function that imports a complete json data file.
* Adding a new 'export.json' function that exports a branch to a json data file.
* Adding a new 'list.branches' function.
* Adding a new 'list.nodes' function.
* Adding an improved algorithm to search for new updates for br4nch.
* Adding support for more python versions.
* Updating documentation.
* Rewritting alot of other functions.
# 💙💛
| 0.6 |
t3_tz38cy
| 1,649,423,481 |
Python
|
Favorite Python Web Framework
|
Django
FastAPI
Flask
Masonite
Bottle
…other?
Also discuss why
| 0.93 |
t3_tz2v7b
| 1,649,422,377 |
Python
|
Does clean code equal "Workplace" code
|
I am a beginner at python and have been following Angela Yu's 100 days of python. I commented on a post regarding my Coffee Machine code been some 400 lines while hers was around 150 lines with the same functionilty.
&#x200B;
This led me to ask this question of, if code works does it matter if it's clean and pythonic.
&#x200B;
I will reference these two tic toe games below:
&#x200B;
18000 lines (no adherence to DRY but simple to understand)
[https://github.com/asweigart/my\_first\_tic\_tac\_toe/blob/9f38b04e857426c5a5b80919ad0b5fce0947c022/tictactoe.py](https://github.com/asweigart/my_first_tic_tac_toe/blob/9f38b04e857426c5a5b80919ad0b5fce0947c022/tictactoe.py)
&#x200B;
1 line (I was shocked that such a thing was even possible, considering my tic tac toe code was around 500 lines with no AI. This code is in my opinion way way to complex and one would probably be working in the realm of datasciences/ML to understand such a thing)
[https://www.reddit.com/r/Python/comments/9ozfeq/tictactoe\_in\_one\_line\_python35/](https://www.reddit.com/r/Python/comments/9ozfeq/tictactoe_in_one_line_python35/)
&#x200B;
Both programs work, but if one was given only the option of picking from the two, which would be preffered in the workplace? In my opinion, the 18000 line code would be acceptable as it allows all team members, novice or not to atleast have some understanding.
&#x200B;
EDIT: Better late than never, but I realised I have been referencing my tic tac toe code of 500 lines vs the 1 and 18000 liners but havent posted it for comparison.
So here it is (I do acknowledge that a tic tac toe game has no relevance to the workplace, but is the code structure I used somewhere along the lines of "hirable".):
[https://pastebin.com/GBCRiGWe](https://pastebin.com/GBCRiGWe)
| 0.5 |
t3_tyztcm
| 1,649,410,916 |
Python
|
Creating 3D Maps with Python (feat.Mapbox)
|
**Creating 3D Maps with Python (feat.Mapbox)**
[https://wooiljeong.github.io/python/mapboxgl\_map/](https://wooiljeong.github.io/python/mapboxgl_map/)
Using WGL provided by Mapbox with Python, I visualized apartment prices in Seoul, Korea on a 3D map. The description of the implementation method is in Korean, but the code is also recorded, so there is no difficulty in understanding it.
https://preview.redd.it/qcnyr389t9s81.png?width=919&format=png&auto=webp&s=d9e1997e4f95119926a04aaa09492a11a3c2be60
| 0.57 |
t3_tyzbab
| 1,649,408,660 |
Python
|
Backgammon Game
|
A game of backgammon. Written with Python and Cython. I'm interested in artificial intelligence so this program has an ai and can play against itself. It uses the monte-carlo tree search algorithm.
https://preview.redd.it/xhkqm66ej8s81.png?width=802&format=png&auto=webp&s=60007f6b59c5471f70b98234be65aa6a9201a551
[https://github.com/Tracing/python-backgammon](https://github.com/Tracing/python-backgammon)
| 0.67 |
t3_tyvodx
| 1,649,393,370 |
Python
|
Best 20 Python Program only for Beginners
|
The Python programming language is one of the most used languages in the world, especially in data analytics. There are many different types of Python projects that you can do. Some of the most common Python project ideas are listed in this blog.
Source Code: [https://www.myguideinfo.com/search/label/python-projects](https://www.myguideinfo.com/search/label/python-projects)
**The 20 Best Python Projects only for Beginners**
1. Finding Mean, Median, Mode in Python without libraries
2. Program to Find LCM of two numbers in Python
3. Find Duplicate Values using Python
4. Python Program to Check Prime Number
5. Find Greater Number Using If Function In Python
6. Taking Multiple User's Input Using While Loop in Python
7. Create a Digital Clock In Python With Source Code
8. Create To-Do List Using Python with Source Code
9. Python Program to Display Calendar with Source Code
10. Create a Password Generator In Python with Source Code
11. Python Program to Print all Prime Numbers in an Interval
12. Python Program to Find the Sum of Natural Numbers
13. Python Program to Find the Factorial of a Number
14. Calculate the Area of a Triangle in Python
15. Python Program to Create a Countdown Timer
16. Python Program to add two Matrices, Transpose, and Multiply
17. Contact Management Project In Python With Source Code
18. Billing System Project In Python With Source Code
19. Vehicle Inventory System In Python With Source Code
20. Library Management System In Python with Source Code
Source Code: [https://www.myguideinfo.com/search/label/python-projects](https://www.myguideinfo.com/search/label/python-projects)
| 0.54 |
t3_tyvlpg
| 1,649,393,079 |
Python
|
I'm 13, trying to learn Python.
|
Where/what do you think I should start, learn first, or do you just have any tips?
Also, make sure what ever you're suggesting is free. Please.
| 0.79 |
t3_tyu7kl
| 1,649,388,175 |
Python
|
Friday Daily Thread: Free chat Friday! Daily Thread
|
Use this thread to talk about anything Python related! Questions, news, projects and any relevant discussion around Python is permitted!
| 0.71 |
t3_tyqfk8
| 1,649,376,010 |
Python
|
With the very little Python experience I have, I coded this little “game” of uno.
|
[link to the python code](https://www.onlinegdb.com/Z0no-dI4B)
| 0.81 |
t3_tymxkf
| 1,649,365,805 |
Python
|
Automate Investopedia stock simulator with Investopedia-bot
|
I made this [program](https://github.com/bassel27/Investopedia-Bot) which allows you to automate Investopedia and compare the stocks you're interested in to take better decisions. What do you think?
| 0.6 |
t3_tymrnf
| 1,649,365,341 |
Python
|
Abandoned Docker Library?
|
Apologies if this isn't the right forum to raise this. I'm hoping folks here might have some insight or can point me in the right direction. I have a build tool that relies on the official Docker library for Python:
[https://github.com/docker/docker-py](https://github.com/docker/docker-py)
It seems like this library has been mostly abandoned by Docker. There hasn't been any new commits for almost 6 months, there are a large number of issues and pull requests that appear to be languishing, and the code owners seem to have sparse activity on GitHub.
Anyone know what gives? Is Docker abandoning the Python library since docker compose is being refactored into GoLang?
| 0.83 |
t3_tylcez
| 1,649,361,461 |
Python
|
Getting started with Python - programming in Python 3.
|
nan
| 0.22 |
t3_tyl0o2
| 1,649,360,548 |
Python
|
I built an all-in-one Python Web and AI/ML Resources Website
|
Hey there,
I just built a Python Resources Website. Divided into two main Pages (Web Backend and AI/Machine Learning) for these Resources, the goal is to simplify the search for some of the best React resources such as:
**1) For Python/Backend:**
• Django, Flask, FastAPI Articles
• Django, Flask, FastAPI Forums latest Discussions (Reddit)
• Django, Flask, FastAPI YouTube Channels Videos
• Django, Flask, FastAPI Websites
• Django, Flask, FastAPI E-books, Snippets
• *Job Opportunities (soon)*
&#x200B;
**2) For Python/AI/ML:**
• AI/ML Articles
• AI/ML Forums latest Discussions (Reddit)
• AI/ML YouTube Channels Videos
• AI/ML Websites
• AI/ML E-books, Snippets
• *Job Opportunities (soon)*
&#x200B;
**Here is the Link 👉** [**helloPython**](https://hellopython.vercel.app/)
&#x200B;
Feel free to give some feedback, I'd like to keep pon working on this project because I love the Python Industry ;)
Thank You!
| 0.57 |
t3_tyi792
| 1,649,352,775 |
Python
|
Send me suggestions
|
Hello, I am 18 and I have started to code last year. I want to check my code (if it is good or not, send me suggestions ;) ) with this example of the ticktacktoe game in the terminal.
Available here : [https://github.com/FortisCodis/PyTicTacToe](https://github.com/FortisCodis/PyTicTacToe)
Sorry for my bad english I am french...
Thanks
| 0.17 |
t3_tyhe6o
| 1,649,350,514 |
Python
|
Build a simple bank management system in python with MySQL
|
nan
| 0.2 |
t3_tyh72s
| 1,649,349,924 |
Python
|
Video Introduction to pandas Library in Python
|
nan
| 0.38 |
t3_tygobz
| 1,649,348,450 |
Python
|
Documentation is highly valued, but often overlooked
|
Hi all, In 2017, Github (opensourcesurveyorg) conducted a survey on open source projects, and we believe that in 2022, some issues are still relevant.
&#x200B;
https://preview.redd.it/p3nop6uhq4s81.png?width=914&format=png&auto=webp&s=6093f8b9dd8d814002c2b01bff334ecc55f85758
It shows the importance of documentation in an Open source project and how frustrating it can be if it’s not a priority. Some important things, in my opinion:
1. When you encounter documentation problems, help a maintainer and open a change request to improve them.
2. Licenses are by far the most important type of documentation for users and contributors.
3. Documentation helps build engaged communities.
4. When communicating about a project, use language that is clear and accessible to people who are not born English or do not read English fluently.
I work for an open-source project; please feel free to comment if you have any tips for improving documentation.
| 0.69 |
t3_tygibq
| 1,649,347,990 |
Python
|
Maze Creator
|
I created a website to create and play with mazes.
Website Link: https://desolate-mountain-91027.herokuapp.com/home/
GitHub Link: https://github.com/ShouvikGhosh2048/MazeCreator
I would like feedback on the website and code.
| 0.5 |
t3_tyg1cd
| 1,649,346,669 |
Python
|
Add machine learning to your apps easily with Google's MediaPipe and Python (Beginner's Guide)
|
Hey everyone!
**I just released** [**this beginner's guide**](https://www.assemblyai.com/blog/mediapipe-for-dummies/) **to using MediaPipe in Python**. MediaPipe provides really easy-to-use APIs for common ML tasks like hand recognition, face tracking, object detection, and more! You can use it to add ML to apps for things like sign language recognition!
Here's a video of how it performs extracting 3D pose data from a video:
&#x200B;
https://reddit.com/link/tyftwn/video/w02ochs5n4s81/player
Let me know what you think!
| 0.82 |
t3_tyftwn
| 1,649,346,097 |
Python
|
Friends and I are tired of online tutorials so we’re running a cohort for learning Python with competitive team games
|
Hi, we’re a group of 4 friends who are working on something we think is cool but want to hear what you think! We’re super early in working on this - if you want this to exist, register interest on [https://delta-academy.xyz](https://delta-academy.xyz/) :)
The best experiences we had when learning Python were working on projects and hackathons. We also benefited from being in cohorts of learners (e.g. at University) - the friends we made have often lasted.
We want to combine these two elements - live competitive coding games with a cohort of fellow Python learners. The cohort will be \~20 people. It’s the format we wanted but couldn’t find online - so we’re creating it!
We would have to charge for running cohorts (not least to cover the prizes!), but haven’t figured out how much yet - just want to know first if this is something anyone wants!
We made a short video that hopefully explains everything in 1 min.
https://reddit.com/link/tye97u/video/hbsy8qs594s81/player
Really keen to hear feedback. :)
| 0.9 |
t3_tye97u
| 1,649,341,649 |
Python
|
Palmette JS | Python and other language template generator.
|
Hi everyone,
I recently made this CLI app that can generate a lot of templates (many in python) of different programming language. Can I ask for a review? Is this a good idea or nah?
(You can install it with "npm install -g palmette-js")
[https://github.com/PalmetteJS/Palmette-js](https://github.com/PalmetteJS/Palmette-js)
| 0.67 |
t3_tycthh
| 1,649,337,218 |
Python
|
Making a face-controlled keyboard (Python OpenCV + MediaPipe)
|
nan
| 0.33 |
t3_tycls0
| 1,649,336,539 |
Python
|
Rtree 1.0 released
|
nan
| 0.83 |
t3_tyb398
| 1,649,331,385 |
Python
|
How to summarize text with Python and machine learning
|
Summarization is a very common task that many developers would like to automate. For example wouldn't it be nice to automatically create a summary of each blog article you're writing? Or automatically summarize documents for your employees? Tons of good applications exist.
In this article I'm showing how easy it is to perform advanced text summarization in Python thanks to Transformers and Bart Large CNN:
[https://nlpcloud.io/how-to-summarize-text-with-python-and-machine-learning.html](https://nlpcloud.io/how-to-summarize-text-with-python-and-machine-learning.html?utm_source=reddit&utm_campaign=la5u8885-fd8e-21eb-ca80-5242ac13d5ja)
Please don't hesitate to ask questions if you have any!
| 0.81 |
t3_tyazf7
| 1,649,330,969 |
Python
|
extreqs: parsing package extras from a requirements.txt
|
I found myself writing the same logic in a couple of `setup.py` scripts so wrote a package to do it: https://pypi.org/project/extreqs/
Broadly, it parses your `extras_require` dict from your `requirements.txt` file using special comments rather than having to define the same thing twice.
As noted in the documentation, there are situations where you wouldn't want to use this, most commonly for libraries. requirements.txt and package dependencies have different purposes in that case: requirements.txt provides a full, (somewhat) reproducible environment for CI and other developers to get an environment with hard versions and all of your linters etc., where package dependencies provide a minimal, permissive environment to allow as many people to use your library as possible. extreqs is primarily designed for applications (web backends, CLIs etc) which have optional extra functionality.
(N.B. not a beginner but it's not a complicated enough codebase to merit anything else...)
| 0.67 |
t3_tyapmu
| 1,649,329,932 |
Python
|
GitHub - corpnewt/ProperTree: Cross platform GUI plist editor written in python.
|
nan
| 0.5 |
t3_ty8hba
| 1,649,320,332 |
Python
|
How To Learn Python
|
nan
| 0.27 |
t3_ty8fp5
| 1,649,320,121 |
Python
|
I made a game from scratch in 48 hours for the Ludum Dare with Python
|
I made all of the code, artwork, sfx, etc. solo during the 48 hours of the Ludum Dare as required by the rules.
https://i.redd.it/acex0iv0y1s81.gif
The game (and its source) are available here:
[https://dafluffypotato.itch.io/explont](https://dafluffypotato.itch.io/explont)
I also [livestreamed almost all of the development](https://www.youtube.com/playlist?list=PLX5fBCkxJmm1is3hgaBi037MEGFjtHJex) and created a [timelapse](https://youtu.be/4cgjYlH2g9g).
&#x200B;
https://preview.redd.it/eat9owgny1s81.png?width=631&format=png&auto=webp&s=5cae8fd8386d01c91135a834685bbaeecb97413a
| 0.97 |
t3_ty6yvn
| 1,649,313,627 |
Python
|
Dockersh : A shell for docker commands with autocomplete
|
Hi everyone,
I was learning Docker and felt that it was hard to remember all the commands and various arguments. I also kept forgetting the names of my containers & images so I decided to build a CLI for Docker using Prompt Toolkit. Hopefully it will be useful for those of you learning & working with devops. Let me know how I can improve.
The project can be found at [https://github.com/solamarpreet/dockersh](https://github.com/solamarpreet/dockersh)
| 0.67 |
t3_ty6f0a
| 1,649,311,338 |
Python
|
Continuous feedback and the 'definition of done'
|
Hey! I wrote a post about what I see is sometimes the short fallings of 'definition of done'. Wonder whether you guys agree with it and have been dealing with such issues?
[https://betterprogramming.pub/youre-never-done-by-definition-c04ac77c616b](https://betterprogramming.pub/youre-never-done-by-definition-c04ac77c616b)
| 0.5 |
t3_ty5lnw
| 1,649,308,203 |
Python
|
What is the best Python -> direct executable package / compiler today? (April,2022)
|
I need to create a few applications that I want to distribute as executables, the options I'm aware of are:
Nuitka
pyinstaller
py2exe
py2app
What else is out there, and what is the BEST?
I'm looking to create a couple of cli's using click, and a couple of GUI's using DearPyGui
| 0.93 |
t3_ty36vb
| 1,649,299,895 |
Python
|
Pong game in just 14 lines.
|
import pygame
pygame.init()
win = pygame.display.set_mode((800, 600))
clock = pygame.time.Clock()
rects = [pygame.Rect(0, 0, 20, 60), pygame.Rect(780, 0, 20, 60), pygame.Rect(390, 290, 20, 20)]
ball_vel = [5, 5]
while clock.tick(60) and not pygame.QUIT in [event.type for event in pygame.event.get()]:
keys = pygame.key.get_pressed()
rects = rects[0].move(0, (keys[pygame.K_s] - keys[pygame.K_w]) * 5).clamp(win.get_rect()), rects[1].move(0, (keys[pygame.K_DOWN] - keys[pygame.K_UP]) * 5).clamp(win.get_rect()), rects[2].move(*ball_vel)
rects[2].topleft = (390, 290) if rects[2].x < 0 or rects[2].right > 800 else rects[2].topleft
ball_vel[1], ball_vel[0] = -ball_vel[1] if rects[2].y < 0 or rects[2].bottom > 600 else ball_vel[1], -ball_vel[0] if rects[2].collidelist(rects[:-1]) != -1 else ball_vel[0]
win.fill((0, 0, 0))
[[pygame.draw.rect, pygame.draw.ellipse][1 if rect == rects[2] else 0](win, (255, 255, 255), rect) for rect in rects]
pygame.display.update()
| 0.83 |
t3_ty15no
| 1,649,293,551 |
Python
|
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
|
Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!
**This thread is not for recruitment, please see** r/PythonJobs **or the thread in the sidebar for that.**
| 0.67 |
t3_txzwcj
| 1,649,289,609 |
Python
|
I made the game Wordle in Python
|
This game is somewhat similar to hangman.
You try to guess a random 5 letter word and the game will tell you the if the placement of each letter is correct or not. Example:
```
O - correct place
? - right letter, wrong place
X - letter is present in word
Word we're looking for: hello
Your word (input): house
Output: O?XX?
```
This continues until you guess the word or give up.
You can look at the code here: [https://github.com/Nextross/Wordle-python](https://github.com/Nextross/Wordle-python)
Any feedback is welcomed!
| 0.72 |
t3_txvx5q
| 1,649,278,243 |
Python
|
The last Python 3.11 alpha (3.11.0a7) is available
|
nan
| 0.95 |
t3_txuukh
| 1,649,275,361 |
Python
|
Continuous Feedback over code
|
Hey everyone! We made something! I wanted to get your feedback on our new open-source platform - Digma. Digma provides observability 🔭 over code and makes it relevant to feature development. It gleans code-relevant insights from OpenTelemetry and other sources and provides in-code feedback 💻. [https://github.com/digma-ai/digma](https://github.com/digma-ai/digma) Python is our first supported language. I'm the author of Digma and am really keen to hear your thoughts!
| 0.57 |
t3_txrs93
| 1,649,267,039 |
Python
|
Blog API built with FastAPI, MySQL, SQLAlchemy, and Alembic
|
nan
| 0.8 |
t3_txrlz4
| 1,649,266,567 |
Python
|
A practical introduction solving differential equations numerically
|
nan
| 0.83 |
t3_txq7d2
| 1,649,262,787 |
Python
|
Configpile: a modern, typed argparse replacement
|
I started documenting astronomy code written by a PhD student, and wanted a command-line parsing library that would be self documenting.
Thus [ConfigPile](https://denisrosset.github.io/configpile/) was born! It's based on dataclasses with annotated types.
Sample code (imports omitted):
@dataclass(frozen=True)
class Calc(Config):
"""
A simple calculator
"""
#: First number to add
x: Annotated[float, Param.store(parsers.float_parser, short_flag_name="-x")]
#: Second number to add
y: Annotated[float, Param.store(parsers.float_parser, short_flag_name="-y")]
c = Calc.from_command_line_()
print(f"{c.x} + {c.y} = {c.x+c.y}")
Running this with "-h", you can a nice usage help automatically generated (through a legacy ArgumentParser). The same can feed the [sphinx-argparse](https://sphinx-argparse.readthedocs.io/en/latest/) extension to include documentation in the project web pages.
Configpile is based on modern Python, is written in mostly functional style, has user-friendly error reporting which accumulates errors instead of bailing out immediately, supports environment variables and INI files.
I'd be super grateful for comments, especially about the documentation and the Python style.
Follow a tutorial here: https://denisrosset.github.io/configpile/tutorial/index.html
Learn about the main concepts here: https://denisrosset.github.io/configpile/concepts/index.html
The package can be easily installed using `pip install configpile`
(Note: many edits for formatting)
| 0.86 |
t3_txq6ch
| 1,649,262,713 |
Python
|
Show the songs that you are listening to on Telegram. (Like Discord's "Listening to") [Recently updated]
|
nan
| 0.5 |
t3_txp8kf
| 1,649,260,175 |
Python
|
UNPHAT method for designing apps
|
I found this to be very useful when thinking about the most important part of writing apps: understanding what to solve and how. It's from https://news.ycombinator.com/item?id=30931831.
Next time you find yourself Googling some cool new technology to (re)build your architecture around, I urge you to stop and follow UNPHAT instead:
Don’t even start considering solutions until you Understand the problem. Your goal should be to “solve” the problem mostly within the problem domain, not the solution domain.
eNumerate multiple candidate solutions. Don’t just start prodding at your favorite!
Consider a candidate solution, then read the Paper if there is one.
Determine the Historical context in which the candidate solution was designed or developed.
Weigh Advantages against disadvantages. Determine what was de-prioritized to achieve what was prioritized.
Think! Soberly and humbly ponder how well this solution fits your problem. What fact would need to be different for you to change your mind? For instance, how much smaller would the data need to be before you’d elect not to use Hadoop?
| 0.67 |
t3_txoq2p
| 1,649,258,798 |
Python
|
I made a small tool to apply "color palette restriction" on images !
|
I got inspired by /r/place and I wanted to exercice my python skills so I tried to make a tool to redraw images with a specific color palette (/r/place color palette)
Here are some examples :
[Reference image](https://preview.redd.it/3p4us69n7xr81.jpg?width=494&format=pjpg&auto=webp&s=0535c1eed010716f053549eec31a88d4453f2f6e)
[Color palette restriction without dithering](https://preview.redd.it/63df44kt7xr81.png?width=494&format=png&auto=webp&s=341497026bb4dd39dc63718cf792ba1e1f3030ef)
[Color palette restriction with Floyd-Steinberg dithering](https://preview.redd.it/xccpwquw7xr81.png?width=494&format=png&auto=webp&s=8156a2f09de8b2a58c92f72ef90a5b017a1df2a7)
It can also work with any color palette provided !
Also, I am using PIL to read and draw on images.
&#x200B;
You can find the source code here : [https://github.com/nrbt25/image-dithering/tree/master](https://github.com/nrbt25/image-dithering/tree/master)
| 0.97 |
t3_txnuzx
| 1,649,256,498 |
Python
|
YAML: The Missing Battery in Python
|
nan
| 0.88 |
t3_txmfli
| 1,649,252,420 |
Python
|
Programming projects for Physics in Python
|
So I am looking for some projects to do in Physics using Python ,when I searched for the same in Quora ,it was too hard to even comprehend .
I am ready to do some reading if it is needed ,I don't like learning Python just through some courses ,I think that learning by creating projects will be a good motivation.
I have knowledge of Calc 1,2,3 a bit of Linear Algebra ,basics of solving diff equations .
I am taking Classical Mechancis and Electromagnetism .
Any suggestion ,I am aiming to score an internship with this project .
Thank you for reading my post .
Have a nice day
| 0.78 |
t3_txm6zl
| 1,649,251,713 |
Python
|
hello this could be an english vocabulary question, what does comprehension mean from 'List Comprehension'? I already learned that is like set builder notation
|
nan
| 0.61 |
t3_txk1nm
| 1,649,244,748 |
Python
|
Scrape Naver Related Search Results with Python
|
Full DIY code:
```python
import requests, json
from parsel import Selector # https://parsel.readthedocs.io/
# https://docs.python-requests.org/en/master/user/quickstart/#passing-parameters-in-urls
params = {
"query": "minecraft", # search query
"where": "web" # web results. works with nexearch as well
}
# https://docs.python-requests.org/en/master/user/quickstart/#custom-headers
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.87 Safari/537.36",
}
html = requests.get("https://search.naver.com/search.naver", params=params, headers=headers, timeout=30)
selector = Selector(html.text)
related_results = []
# https://www.programiz.com/python-programming/methods/built-in/enumerate
for index, related_result in enumerate(selector.css(".related_srch .keyword"), start=1):
keyword = related_result.css(".tit::text").get().strip()
link = f'https://search.naver.com/search.naver{related_result.css("a::attr(href)").get()}'
related_results.append({
"position": index, # 1,2,3..
"title": keyword,
"link": link
})
print(json.dumps(related_results, indent=2, ensure_ascii=False))
```
Outputs:
```json
[
{
"position": 1,
"title": "마인크래프트",
"link": "https://search.naver.com/search.naver?where=nexearch&query=%EB%A7%88%EC%9D%B8%ED%81%AC%EB%9E%98%ED%94%84%ED%8A%B8&ie=utf8&sm=tab_she&qdt=0"
},
{
"position": 2,
"title": "minecraft 뜻",
"link": "https://search.naver.com/search.naver?where=nexearch&query=minecraft+%EB%9C%BB&ie=utf8&sm=tab_she&qdt=0"
},
{
"position": 3,
"title": "craft",
"link": "https://search.naver.com/search.naver?where=nexearch&query=craft&ie=utf8&sm=tab_she&qdt=0"
},
{
"position": 4,
"title": "mine",
"link": "https://search.naver.com/search.naver?where=nexearch&query=mine&ie=utf8&sm=tab_she&qdt=0"
},
{
"position": 5,
"title": "mojang",
"link": "https://search.naver.com/search.naver?where=nexearch&query=mojang&ie=utf8&sm=tab_she&qdt=0"
}
]
```
Alternative solution using [Naver Related results API](https://serpapi.com/naver-related-results) from SerpApi:
```python
from serpapi import NaverSearch
import os, json
params = {
# https://docs.python.org/3/library/os.html#os.getenv
"api_key": os.getenv("API_KEY"), # your serpapi api key
"engine": "naver", # search engine to parse results from
"query": "minecraft", # search query
"where": "web" # web results
}
search = NaverSearch(params) # where data extraction happens
results = search.get_dict() # JSON -> Python dictionary
related_results = []
# iterate over "related_results" and extract position, title and link
for related_result in results["related_results"]:
related_results.append({
"position": related_result["position"],
"title": related_result["title"],
"link": related_result["link"]
})
print(json.dumps(related_results, indent=2, ensure_ascii=False))
```
Outputs:
```json
[
{
"position": 1,
"title": "마인크래프트",
"link": "https://search.naver.com?where=nexearch&query=%EB%A7%88%EC%9D%B8%ED%81%AC%EB%9E%98%ED%94%84%ED%8A%B8&ie=utf8&sm=tab_she&qdt=0"
},
{
"position": 2,
"title": "minecraft 뜻",
"link": "https://search.naver.com?where=nexearch&query=minecraft+%EB%9C%BB&ie=utf8&sm=tab_she&qdt=0"
},
{
"position": 3,
"title": "craft",
"link": "https://search.naver.com?where=nexearch&query=craft&ie=utf8&sm=tab_she&qdt=0"
},
{
"position": 4,
"title": "mine",
"link": "https://search.naver.com?where=nexearch&query=mine&ie=utf8&sm=tab_she&qdt=0"
},
{
"position": 5,
"title": "mojang",
"link": "https://search.naver.com?where=nexearch&query=mojang&ie=utf8&sm=tab_she&qdt=0"
}
]
```
The difference between DIY and API solution is that you don't need to create the parser from scratch, maintain it, or figure out how to bypass blocks from Naver.
Full blog post: https://serpapi.com/blog/scrape-naver-related-search-results-with-python/
| 0.4 |
t3_txif8z
| 1,649,238,341 |
Python
|
Extending pylint with plugins
|
nan
| 0.5 |
t3_txfsuz
| 1,649,226,686 |
Python
|
A Practical Introduction To Web Scraping With Python
|
nan
| 0.96 |
t3_txf65f
| 1,649,224,130 |
Python
|
Python email sender
|
Hi everyone, I have created a script that sends an email to whoever I want using data retrieved from an API (I chose News API, and it will send me the top 20 news of the day).
[https://github.com/jrodriigues/news-email-sender](https://github.com/jrodriigues/news-email-sender)
Take a look, let me know what you think, and how to improve it!
| 0.6 |
t3_txd85l
| 1,649,217,069 |
Python
|
I made my first ever programming assignment into a youtube tutorial
|
nan
| 0.64 |
t3_txbulk
| 1,649,212,511 |
Python
|
Termtyper - Typing in terminal is fun !
|
Termtyper is a TUI (Text User Interface) typing application that provides you a great feel with typing with a lot of options to tweak!
It is highly inspired by [monkeytype](https://monkeytype.com/)
It is built on top of [textual](https://github.com/Textualize/textual) which provides the UI for the application
github: [https://github.com/kraanzu/termtyper](https://github.com/kraanzu/termtyper)
&#x200B;
https://reddit.com/link/txbsdd/video/ojo8k2o3mtr81/player
| 0.83 |
t3_txbsdd
| 1,649,212,316 |
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_tx8uqj
| 1,649,203,209 |
Python
|
Why and how to use conda?
|
I'm a data scientist and my main is python. I use quite a lot of libraries picked from github. However, every time I see in the readme that installation should be done with conda, I know I'm in for a bad time. Never works for me.
Even installing conda is stupid. I'm sure there is a reason why there is no "apt install conda"...
Why use conda? In which situation is it the best option? Anyone can help me see the light?
| 0.9 |
t3_tx73j8
| 1,649,198,092 |
Python
|
Online coding video tutorials - Opinions
|
Hello everyone,
I am currently creating some space science + Python [YouTube tutorials](https://youtube.com/c/Astroniz). In these videos I do some coding and provide some explanations on what I am doing, the science behind it etc.
Now I was wondering whether this is a good approach at all. I really like creating some content on YouTube (no I am not a professional one with my few 100 subscribers), and I am eager to improve it steadily. However I thought that "live coding" may take too much time and isn't easy to follow. My idea is to explain e.g., science related Jupyter Notebook cells in the videos to shorten the length. The code is provided on GitHub anyway, so a viewer could follow my tutorial (and thoughts) more easily. The coding would be reduced to a minimum and the focus could move to the "non coding" part.
Any ideas or comments would be appreciated!
Thomas
| 0.6 |
t3_tx6k1q
| 1,649,196,551 |
Python
|
Rubik's Cube Model in Python using OOP
|
I've been thinking for a while about developing a model to simulate a Rubik's cube in Python. I wanted to make use of object-oriented programming, and this project was the perfect excuse to get down to work. 💻⌨️🖖
https://carlosgrande.me/rubiks-cube-model/
| 0.84 |
t3_tx6gfb
| 1,649,196,238 |
Python
|
What happened between SciPy creater Travis Oliphant and Enthought?
|
I was listening to his interview on the [Lex Friedman podcast](https://open.spotify.com/episode/2U2AkSSuAzmZi7nmGzJboW?si=28e8c7d915e04f75) and he mentioned that he is no longer friends with the founder of Enthought because he started Anaconda. I can't find any details online, does anyone know the story?
| 0.7 |
t3_tx67bv
| 1,649,195,579 |
Python
|
My first package to pypi. Connpy: Network connection manager and automation module
|
Hi!
So a little bit of background, I'm a network engineer (ccie), with 10+ years of experience in networking, and i'm a really lazy guy so usually i try to automate and script everything. long time ago i created my bash connection manager and been using it since. A month ago i decided it was time to upgrade it to python and add the automation function i always wanted, and that is how connpy was born.
I'm not a programmer so it may have some issues! let me know.
[https://github.com/fluzzi/connpy/](https://github.com/fluzzi/connpy/) <- here is the link, it also have some documentation it should be easy to use. It's created for linux as it's what i use everyday but i did some testing on macos and it should work.
## connection manager
First its the connection manager, it adds the commands conn/connpy to shell, and you can add all the devices you manage easily:
- conn --add server1
you can add folders and subfolders to organize your devices. i use to work with a lot of clients so i have like 400+ nodes divided in multiples folders.
- conn --add "@office"
- conn --add "@servers@office"
- conn --add server2@servers@office
- conn --add server3@servers@office
- conn --add router1@office
when you are creating a new node to connect, it allows you to refer profiles, this way you can manage passwords and other information in 1 place and use it in multiple nodes.
- conn profile --add officeuser
then you reference inside the node configuration using "@officeuser".
you can use profiles to send multiple passwords in case you use 1 or more jumphosts.
Once the nodes are created you just connect to them without passwords.
- conn server1
- conn server2@servers@home
- conn server
## automation module
this is the new feature, once you created your nodes you can use them with the automation module
- import connpy
- config = connpy.configfile()
- server1 = config.getitem("server1@office")
- router1 = config.getitem("router@office")
- server = connpy.node("server1",**server1,config = config)
- router = connpy.node("router1",**router1,config = config)
- print(router.run(["term len 0", "show run"]))
- if server.test("ls -la", "folder to find"):
- print("folder found")
- else:
- print("missing folder")
You can also run in multiple devices at the same time using class nodes. (more in the documentation)
Hope someone find it useful!!
thanks!
| 0.89 |
t3_tx604l
| 1,649,195,030 |
Python
|
"Bicycle or Metro": My first interactive web app using Dash/Flask.
|
I collected data from the Google Direction API and built an interactive app comparing travel duration times between Bicycle and Public Transportation in Santiago, Chile.
Each specific route to a point in the map can be accessed by clicking on the destination point, and the relevant information will be displayed.
The app is deployed on Heroku (forgive the slow response): [http://biciometro.herokuapp.com](http://biciometro.herokuapp.com) . The website is in Spanish, but its features should be easy to understand.
**Tools:**
* For the GeoJSON grid, I used this [grid creator](https://cityofaustin.github.io/geojson-grid/#). I used Pandas, Dash, Plotly, NumPy and Mapbox. Everything is coded in Python.
* Source code for the app: [https://github.com/mirkosimunovic/biciometro](https://github.com/mirkosimunovic/biciometro)
* Please show support with a Github star if you like the project. Thank you!
| 0.8 |
t3_tx4xj4
| 1,649,192,222 |
Python
|
Create a timelapse of any canvas area and any timeframe of r/place
|
[(Github) Source code and download](https://github.com/gislerro/rplace-cropped-timelapse-creator)
Configuration in the config.yaml file:
* range of images to create timelapse for [(archive of snapshots here)](https://rplace.space/combined/)
* granularity of frames (take every n-th image - determines speed of timelapse)
* top-left coordinates of the canvas timelapse
* width & height of the canvas
* mp4 output dimensions & name
&#x200B;
[Example](https://reddit.com/link/tx3x67/video/vgytvsfpprr81/player)
| 0.74 |
t3_tx3x67
| 1,649,189,564 |
Python
|
Applications of Python
|
Hey! Anyone who is interested in learning about the applications of python in the field of automation should check out [this](https://medium.com/@Nick_27/automation-using-python-66ec75a6b0ba) article.
It really encourages you to learn more about the language!
| 0.3 |
t3_tx0enu
| 1,649,180,149 |
Python
|
Learning Python
|
Python just makes so much freaking sense! LOVING IT!!
| 0.8 |
t3_tx0cns
| 1,649,179,997 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.