What do you want to save?
Add Code snippet
New code examples
-
Python 2021-10-25 15:47:08
merge two named tuples
from collections import namedtuple from functools import reduce def reducer( accum, d ): accum.update(d) return accum def tuplemerge( *dictionaries ): merged = reduce( reducer, dictionaries, {} ) return namedtuple('Merged', merged )(**merg... Add solution -
Python 2021-10-25 14:47:09
python submit work to redis
# step 1: import the redis-py client package import redis # step 2: define our connection information for Redis # Replaces with your configuration information redis_host = "localhost" redis_port = 6379 redis_password = "" def hello... Add solution -
Python 2021-10-24 20:08:11
kivy video recorder
from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.boxlayout import BoxLayout from kivy.uix.image import Image from kivy.clock import Clock from kivy.graphics.texture import Texture from kivy.properties import StringProperty, Numeri... Add solution -
Python 2021-10-24 15:41:09
auto fill in entry in tkinter
from Tkinter import * import re lista = ['a', 'actions', 'additional', 'also', 'an', 'and', 'angle', 'are', 'as', 'be', 'bind', 'bracket', 'brackets', 'button', 'can', 'cases', 'configure', 'course', 'detail', 'enter', 'event', 'events', 'example', 'fiel... Add solution -
Python 2021-10-23 03:51:07
extract image from pdf python
import PyPDF2 from PIL import Image if __name__ == '__main__': input1 = PyPDF2.PdfFileReader(open("input.pdf", "rb")) page0 = input1.getPage(0) xObject = page0['/Resources']['/XObject'].getObject() for obj in xObject... Add solution -
Python 2021-10-22 20:34:09
string validators hackerrank solution
if __name__ == '__main__': s = input() print(any(i.isalnum() for i in s)) print(any(i.isalpha() for i in s)) print(any(i.isdigit() for i in s)) print(any(i.islower() for i in s)) print(any(i.isupper() for i in s)) #The any() funct... Add solution -
Python 2021-10-21 06:57:04
create internal etl for people to upload data with python and flask
from flask import Flask, render_template, requestfrom werkzeug import secure_filenameapp = Flask(__name__)@app.route('/upload')def upload_file(): return render_template('upload.html') @app.route('/uploader', methods = ['GET', 'POST'])def upload_file(): ... Add solution -
Python 2021-10-20 16:58:10
display flask across network
from flask import Flask app = Flask(__name__) @app.route('/') def index(): return "Hello world!" if __name__ == '__main__': app.debug = True app.run(host="0.0.0.0") #host="0.0.0.0" will make the page accessable ... Add solution -
Python 2021-10-16 13:44:06
python increment filename by 1
import glob import re import os def main(): # We want all files that are S00E0x for name in glob.glob('./*S0*'): # We want to find in the filename 'Exx' and increase xx by 1 new_name = re.sub('(E)([0-9]{2})', increment, name) os.rename(... Add solution -
Python 2021-10-13 01:36:05
how to create a joystick in pyqt4
from PyQt4.QtGui import * from PyQt4.QtCore import * import sys from enum import Enum class Direction(Enum): Left = 0 Right = 1 Up = 2 Down = 3 class Joystick(QWidget): def __init__(self, parent=None): super(Joystick, self)._... Add solution
Best helpers
Ranking is empty