What do you want to save?
Add Code snippet
New code examples
-
Python 2021-09-04 22:49:02
add year to id django
import datetime from uuid import uuid4 def create_id(): now = datetime.datetime.now() return str(now.year)+str(now.month)+str(now.day)+str(uuid4())[:7] # in your model: id = models.CharField(primary_key=True, default=create_id, editable=False) Add solution -
Python 2021-09-04 11:39:01
how to make a dice program in python
import random run = 1 level = 0 while(run == 1): print("**ROUND " + str(level) + "**") print("player 1: ",random.randint(0, 6)) print("player 2: ",random.randint(0, 6)) run = int(inp... Add solution -
Python 2021-09-04 04:32:03
send data from b;uetooth to python script raspberry pi
#!/usr/bin/env python #Run.py import os from bluetooth import * from wifi import Cell, Scheme import subprocess import time wpa_supplicant_conf = "/etc/wpa_supplicant/wpa_supplicant.conf" sudo_mode = "sudo " def wifi_connect(ssid, psk)... Add solution -
Other 2021-09-04 04:14:01
godot display fps
extends Label # Timestamps of frames rendered in the last second var times := [] # Frames per second var fps := 0 func _process(_delta: float) -> void: var now := OS.get_ticks_msec() # Remove frames older than 1 second in the `times` array whil... Add solution -
Python 2021-09-04 00:23:03
liste d'adjacence simple code python
#! /usr/local/bin/python #-*- coding: utf_8 -*- #import dijkstra class Graphe(object): """Classe représentant un graphe. Un graphe est représenté par un dictionnaire. """ def __init__(self): &quo... Add solution -
Python 2021-09-03 23:16:02
atm python program
# ATM Processes while True: # Reading id from user id = int(input("\nEnter account pin: ")) # ... Add solution -
Python 2021-09-03 21:00:03
split int and string in python
Python3 code to demonstrate working of # Splitting text and number in string # Using re.compile() + re.match() + re.groups() import re # initializing string test_str = "Geeks4321" # printing original string print("The original str... Add solution -
Other 2021-09-03 20:49:01
Generate 10 verification codes of length 4 and print them, e.g.,
#random package to find random integer import random #This method returns a random value of given length #len - parameter determines the length of the random value def random_value(len): result = '' #len decrements with each iteration #Hence... Add solution