text
stringlengths
8
6.05M
from django.shortcuts import render, redirect from .filters import PupilFilter from .forms import PupilForm, ClassroomForm, BahoForm from .models import Classroom, Pupil, Baho from django.core.paginator import Paginator from django.views.generic import DetailView, ListView class PupilListView(ListView): model = P...
from Model.Point import Point class Segmento: seccion = [Point(), Point()] especularidad = False transparencia = False lado="" def __init__(self, espec=False, puntos=[Point(), Point()], trans=False): self.especularidad = espec self.seccion = puntos self.transparencia = tran...
# import dependencies from flask import Flask, jsonify, render_template from accidentsdata import read_accidents, read_accidents_severity,\ read_accidents_severity,read_accidents_state, read_accidents_zipcode,read_accidents_all app = Flask(__name__) #Define flask routes @app.route('/') ##route to render index.htm...
from oscpy.server import OSCThreadServer from time import sleep def callback(*values): print("got values: {}".format(values)) osc = OSCThreadServer() sock = osc.listen(address='0.0.0.0', port=8000, default=True) osc.bind(b'/send_i', callback) sleep(1000) osc.stop()
#!/usr/bin/python # # Move_Turtle.py # # Created on: Nov 9, 2016 # Author: Elad Israel 313448888 # import sys, rospy from geometry_msgs.msg import Twist from turtlesim.msg import Pose #determines whether location should be displayed or not shouldDisplay=True def pose_callback(pose_msg): global shouldDispla...
# Generated by Django 3.0.8 on 2020-11-28 06:30 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('facilitators', '0003_auto_20201118_1849'), ] operations = [ migrations.RemoveField( model_name='facilitatorqueries', ...
import shutil import os import re from collections import defaultdict def read_file_path(folder): file_dict = defaultdict(list) for subject_name in os.listdir(folder): for img_name in os.listdir(folder + "/" + subject_name + "/"): img_no = img_name[:img_name.rindex(".")] file_d...
import sys import re import logging def run_calc(calc_str): res = 0 err = '' print('run_calc: ', calc_str) calc_str_clean = calc_str.replace(' ', '') add_parts = calc_str_clean.split('+') for i in range(len(add_parts)): print('add_part: ', add_parts[1]) if '-' in a...
import numpy as np import scipy.spatial def get_spatial_interpolation_kernel(source_location, target_location, method='kriging', sigma_um=20., p=1, num_closest=3, dtype='float32', force_extrapolate=False): """ Compute the spatial kernel...
from jaeger_client import Config from opentracing.scope_managers.asyncio import AsyncioScopeManager def initialize_tracing_client( service_name, reporting_host='localhost', reporting_port='6831' ): config = Config( config={ 'sampler': {'type': 'const', 'param': 1}, 'loc...
from selenium import webdriver import unittest from time import sleep,ctime def login_regular(driver,phone="18583965785"): driver.find_element_by_id("loginBtn-text").click() driver.switch_to.frame("indexFrame") driver.find_element_by_id("js-phone-num").clear() driver.find_element_by_id("js-code-val")....
#! /user/bin/env python # _*_ coding: utf-8 _*_ # __author__ = "王顶" # Email: 408542507@qq.com """ 循环切片实现 需求总是改变,一会是4层金字塔,一会儿是5层金子塔 到底要几层,改一下 while 循环的条件变量就行了 """ level = 0 line = '' stars = '*******************************************' spaces = ' ' while level < 4: n ...
from dataclasses import dataclass from typing import Union from rdflib import OWL, Graph from rdflib.term import Node, BNode from funowl.base.cast_function import exclude from funowl.base.fun_owl_choice import FunOwlChoice from funowl.identifiers import IRI from funowl.writers import FunctionalWriter @dataclass cla...
a=1 A=2 A1=3 #2b=4 print(a, A, A1) ''' 변수명 정하기 1) 영문과 숫자, _로 이루어진다. 2) 대소문자를 구분한다. 3) 문자나, _ 로 시작한다. 4) 특수문자를 사용하면 안된다. ''' a,b,c = 3,2,1 print(a,b,c) #값 교환 - 프로그래밍에서 많이씀 a,b = 10, 20 print(a,b) a,b = b,a print(a,b) #변수 타입 a = 123456782569871598715 print(a) a=12.123456789123456789 print(a) # 8byte 용량까지만 출력이 됨 ...
#!/usr/bin/python3 from typing import List, Tuple from enum import Enum, auto import argparse from zpool_parser import get_zpool_status, ZPoolState, DriveStatus, SubpoolType, SubpoolStatus, ZPoolStatus def export_zfs_text(pool_data: List[ZPoolStatus]): return export_zfs_pool_health(pool_data) \ + export_...
from .utils import sendMail MAIL_DEFAULTS = { "SHARED_WITH_ME": { "title": "{sender_name} has shared {resource_name} with you", "body": "Hi {recepient_name},\n Kindly use this link below to access {resource_url}" } } def send_mail(type, user_list, title_kwargs, body_kwargs): for user in u...
from rest_framework import permissions, viewsets from rest_framework.decorators import api_view, permission_classes, authentication_classes from rest_framework.views import APIView from rest_framework.permissions import AllowAny from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponse ...
# Generated by Django 2.0.2 on 2018-03-07 12:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('articles', '0020_auto_20180307_1042'), ] operations = [ migrations.AddField( model_name='article', name='author_name...
import lstm as net import utils import json import argparse import torch import data_loader from sklearn.metrics import confusion_matrix, precision_recall_fscore_support arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--data_set', default='val', choices=['train', 'val', 'test'], help='The data set yo...
class Worker(object): """Базовый класс""" def __init__(self, name, surname, position, income): self.name = name self.surname = surname self.position = position self.__income = {'wage': income[0], 'bonus': income[1]} class Position(Worker): def get_full_name(self): ...
from Circle import Circle from Rectangle import Rectangle def main(): circle = Circle(1.5) print("A Circle", circle) r = Rectangle(2, 4) print("A rectangle ", r) main()
from fysql import Table from fypress import FyPress fypress = FyPress() class FyPressTables(Table): db = fypress.database.db
class Solution: def canJump(self, nums): maximum_distance = 0 for i, num in enumerate(nums): if i > maximum_distance: return False maximum_distance = max(maximum_distance, i + num) return True
from django.test import TestCase, tag from django.contrib.auth.models import User from apps.library.models import Book class LibraryTestCase(TestCase): list_url = '/library/' detail_url = '/library/book/{id}/' create_url = '/library/book/add/' @classmethod def setUpTestData(cls): admin_cr...
from datetime import datetime from flask import render_template, flash, redirect, url_for, request, g, \ jsonify, current_app from flask_login import current_user, login_required from flask_babel import _, get_locale from guess_language import guess_language from app import db from app.main.forms import EditProfile...
FREE = 0 FIT = 1
import copy import os from collections import defaultdict import chainer import numpy as np from chainer import DictSummary from chainer import Reporter from chainer.training.extensions import Evaluator from overrides import overrides from sklearn.metrics import f1_score import config class ActionUnitEvaluator(Eval...
from babel import Locale from decimal import Decimal from decimal import ROUND_HALF_UP from functools import cached_property from numbers import Integral from onegov.core.elements import Link from onegov.core.i18n import SiteLocale from onegov.core.layout import ChameleonLayout from onegov.core.static import StaticFile...
from src.image import plot_function from src.pattern_recognition import linear ################# # Inputs ################# def main(): x = [ [0, 0], [1, 0], [2, 0], [0, 1], [1, 1], [2, 1], ] y = [ 1, 1, 1, -1, -1, ...
from typing import List # 方法3: class Solution: def trap(self, height: List[int]) -> int: """ 双指针,指向从左,从右的当前最高, 算出来后减去最大矩形 """ lmax, rmax, res = 0, 0, 0 for i in range(len(height)): lmax = max(lmax, height[i]) rmax = max(rmax, height[-1 - i]) ...
import json import os import time import pandas as pd from constants import REGION_LIST class Utils: @staticmethod def get_region_name_by_code(your_code: str): for (code, name) in REGION_LIST: if your_code == code: return name return '' @staticmethod de...
import numpy as np import pandas as pd txt = "./data0.txt" file = open(txt, 'r') lines = file.readlines() data_size = len(lines) state = [] action = [] index = 0 temp = "" for index, line in enumerate(lines): if line.find("[") != -1 and line.find("]") != -1: line = line.strip('\n') ...
# Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
#1/usr/bin/env/python # -*- coding: utf-8 -*- from app.command.fakeItCommand import FakeIt from cleo import Application application = Application() application.add(FakeIt()) if __name__ == '__main__': application.run()
""" 此conftest.py文件用作确保直接在项目下执行pytest命令时能正常导入utils等模块。 也可以不使用该文件,但是在项目中执行时要使用python -m pytest来执行用例。 """ import os from datetime import datetime import pytest from dotenv import load_dotenv from utils.notify import Email load_dotenv() # 将项目下的.env文件中变量添加到环境变量中 def pytest_configure(config): """更改生成报告的路径""" htmlp...
# pow(x,0.5)函数可以计算x为正数的平方根 那么pow(x,0.5)计算x为负数的平方根输出为: # 复数 # 打印信息换行使用的字符为: # \n # val=pow(2,1000),请用一行代码返回val结果的长度值 # len(eval(val)) # %运算符的含义: # 求余
#!/usr/bin/env python import random import time from subprocess import call score=0 idx=0 while True: for x in range(2,12): idy=0 idx+=1 for y in range(2,12): idy+=1 call(["clear"]) print "{0} {1} * {2} = {3}".format("\n"*idx+" "*idy,x,y," ") ...
from flask import Flask app = Flask(__name__) from etsy import views
# encoding: utf-8 from __future__ import unicode_literals import pytest import operator from collections import OrderedDict as odict from marrow.mongo import Document, Field from marrow.mongo.field import String, Number, Array, Embed from marrow.mongo.query import Ops, Q from marrow.mongo.util.compat import py3, str...
#coding:utf-8 import tensorflow as tf import tensorflow.contrib.eager as tfe from tensorflow.examples.tutorials.mnist import input_data from tensorflow.keras.datasets import mnist tfe.enable_eager_execution() from tensorflow.keras import optimizers from tensorflow.keras.datasets import cifar10, mnist from tensorflow.k...
# eatvowels.py def eat_vowels(s): """ Removes the vowels from s. >>> eat_vowels('Apple Sauce') 'ppl Sc' """ return ''.join([c for c in s if c.lower() not in 'aeiou'])
from mysqlhelper import MysqlHelper from hashlib import sha1 from getpass import getpass import string mysql=MysqlHelper('db5') #给字符串进行加密 def update_pwd(passwd): s=sha1() s.update(passwd.encode()) passwd=s.hexdigest() return passwd #注册函数 def register(): while True: #接收用户名 username...
import numpy print("add two numbers") a=numpy.array([2,3,4]) b=numpy.array([3,2,5]) print("Sum of {} and {} is {}".format(a,b,a+b))
########################################################### # Module: phate_annotation.py # Programmer: Carol L. Ecale Zhou # # Data of last update: October 2016 - code being modified from CGP code base # 03 January 2017 - modified output report in method printAnnotationRecord() # 05 January 2017 - adding code t...
import requests # pip install requests from bs4 import BeautifulSoup # pip install beautifulsoup4 import urllib.request from urllib.error import HTTPError from urllib.error import URLError import http.client from socket import timeout from requests.exceptions import ConnectionError import json, sys def desc...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # В этом файле определены правила. from re import finditer, sub from .templates import (units, zh_units, forms, pre_acc, pre_units, r_ca, d_ca, v_ca, t_ca, p_ca, adj_pad, mn_...
#!/usr/bin/env python __author__ = "Akhilesh Kaushal","Cristian Coarfa" import os,sys,re,argparse import pandas as pd import numpy as np import glob from itertools import permutations import datetime import subprocess import csv import time class MACS2_CALL: DEBUG = 1 DEBUG_TrackCoverage = True #DEBUG_...
import findspark from pyspark import SparkContext from pyspark.streaming import StreamingContext from pyspark.sql.functions import desc import time from collections import namedtuple import json with open('properties_user', 'r') as f: user_data = json.load(f) def run_spark(): findspark.init(user_data['findspar...
import numpy as np import scipy import matplotlib.pyplot as plt import math import csv import cv2 as cv rows = [] with open('depth_1.csv', 'r') as csvfile: # creating a csv reader object csvreader = csv.reader(csvfile) # extracting each data row one by one for row in csvreader: rows.append(row) csvfile...
from django.db import models import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from gene_register.models import Gene class Variant (models.Model): chromosome = models.CharField(max_length=30) position = models.IntegerField() reference = models.CharField(max...
#As listas permitem armazenar diversos valores em uma unica variavel #Para utilizar uma lista usamos[]: lista_linguagens = ['Python', 'Java', 'C#', 'PHP', 'Javascript'] #Para mostrar uma lista usamos: print('Mostrando lista') print(lista_linguagens) print('------------------------------------') #Para acessar element...
#!/usr/bin/python import my_pkg if __name__== '__main__': a=0 while 1 : a=input("Select menu: 1)conversion 2)union/intersection 3)exit ? ") if a=='1' : b=input("input binary number : ") print(my_pkg.conversion(b)) elif a=='2' : c=input("1st list: ") d=input("2nd list: ") print(my_pkg.uni_int...
from collections import Counter import os import wikidata path = 'vocab' def _types_vocab(): if not os.path.exists(os.path.join(path,'types.vocab')): return [] with open(os.path.join(path,'types.vocab'), 'r') as f: return f.read().splitlines() def _properties_vocab(): if not os.path.exists(os.path.join...
class Planet(): def __init__(self, name, parent): self.name = name self.parent = parent self.children = [] def totalOrbits(self): if self.parent == None: return 0 return 1 + self.parent.totalOrbits() def main(): planetList = registerPlanets() orbitCount = 0 for planet in planetList: orbitCount +...
# Exploit Title: Apache HTTP Server 2.4.50 - Remote Code Execution (RCE) (3) # Date: 11/11/2021 # Exploit Author: Valentin Lobstein # Vendor Homepage: https://apache.org/ # Software Link: https://github.com/Balgogan/CVE-2021-41773 # Version: Apache 2.4.49/2.4.50 (CGI enabled) # Tested on: Debian GNU/Linux # CVE ...
#!/usr/bin/python3 """Provides a function to append text to a file""" def append_write(filename="", text=""): """Append text to a file""" with open(filename, 'a') as ostream: return ostream.write(text)
#!/usr/local/anaconda3/bin/python3 from __future__ import division import sys sys.path.insert(0, '/home/machen/face_expr') import cProfile import pstats import random from chainer.datasets import TransformDataset from time_axis_rcnn.extensions.special_converter import concat_examples_not_string try: import m...
from saga.exceptions import DoesNotExist from lib.exception.file_exists_exception import FileExistsException import saga class FilesystemService: """ Service for performing fielsystem operations on GRID. It's implemented using Saga library. """ def __init__(self, file_class=saga.filesyst...
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-10-16 22:43 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Crea...
""" Utility program for project ball-ping-pong This program takes a video of a players playing ping pong (need not include the players) and predicts the trajectory of the ball, with only partial frames of the video. The basic idea is to run optical flow over two adjacent (or close-in-time) frames to estimate a velocit...
import time import json import pytest from datetime import timedelta from psycopg2.extras import NumericRange from pytest import mark from sedate import as_datetime, replace_timezone @mark.flaky(reruns=3) def test_browse_matching(browser, scenario): scenario.add_period(title="Ferienpass 2016") for i in rang...
import RPi.GPIO as GPIO import serial from time import sleep import signal import struct def sigterm_handler(signal,frame): GPIO.cleanup() print("cleaning up gpio from signal handler") exit(0) signal.signal(signal.SIGINT, sigterm_handler) signal.signal(signal.SIGTERM, sigterm_handler) BLUEFRUIT_MODE_COMMAND = 1 BL...
import argparse import time from pathlib import Path import numpy as np import pydng from datasets import Dataset from kaldi import Kaldi from select_models import select_model BASE_DIR = Path.home().joinpath('dompteur') def main(models, experiments, dataset_dir, phi, low, high): # create kaldi instance mod...
# Generated by Django 3.0.8 on 2020-07-16 14:18 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('profiles', '0007_guides_quotedcharges'), ] operations = [ migrations.CreateModel( ...
import common_vars as c_vars import pandas as pd import numpy as np from datetime import datetime from scipy import sparse import pickle import bisect from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import OneHotEncoder from sklearn.preprocessing import StandardScaler from imblearn.over_sampl...
def toh(s, d, e, n): if n <= 0: print("return from toh({}, {}, {}, {})".format(s, d, e, n)) return #print("calling toh({}, {}, {}, {} -1)".format(s, e, d, n)) toh(s, e, d, n-1) #print("after toh({}, {}, {}, {})".format(s, d, e, n)) print("move {} to {} disc {}".format(s, d, n)) #print("calling toh({}, {}, {}...
#!/usr/bin/env python """ _GetAvailableFilesByLimit_ Oracle implementation of Subscription.GetAvailableFilesByLimit """ from WMCore.WMBS.Oracle.Subscriptions.GetAvailableFiles import GetAvailableFiles as GetAvailableFilesOracle class GetAvailableFilesByLimit(GetAvailableFilesOracle): def execute(self, subscripti...
Nom = input("Entrer votre nom :") Prenom = input("Entrer votre prenom :") Age = input("Entrer votre âge :") if (Age < str(18)): print("Désolé " + Prenom + " " + Nom + " mais vous n'avez pas l'âge requis pour " + "entrer sur ce site ^^") else: print("Bienvenue " + Prenom + " " + Nom)
# ---------------------------------------------------------------------------- # Copyright 2014 Nervana Systems Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.o...
# Enter your code here. Read input from STDIN. Print output to STDOUT import re S = input() # m = re.search("(\w(?!_))\\1+", S) m = re.search(r"([a-zA-Z0-9])\1+", S) print(m.group(1) if m else "-1")
def solution(index): if index < 0: return -1 digits = 1 while True: if digits == 1: numbers = 10 else: numbers = 9*pow(10, (digits-1)) if index < digits * numbers: return digit_at_index2(index, digits) index -= numbers*digits ...
from zope.interface import implements, alsoProvides, Interface from zope.component import getMultiAdapter, provideUtility, provideAdapter from souper.interfaces import ICatalogFactory from souper.soup import get_soup, Record, NodeAttributeIndexer from repoze.catalog.indexes.field import CatalogFieldIndex from repoze.ca...
name = input("What is your name? ") print('Hi',name,'welcome to class.') print('Hello {}!'.format(name),'welcome.')
from lib.workflow.workflow_parser import WorkflowParser from lib.workflow.job_factory import JobFactory from lib.workflow.job_scheduler import JobScheduler import time class WorkflowRunner: """ Runs the jobs specified in workflow file. """ def __init__(self, filesystem, job_submission): """ ...
import pandas as pd import numpy as np ser = { 'index': [0, 1, 2, 3], 'data': [145, 142, 38, 13], 'name': 'songs' } def get(ser, idx): value_idx = ser['index'].index(idx) return ser['data'][value_idx] print get(ser, 1) print get(ser, 3) songs = { 'index': ['Paul', 'John', 'George', 'Ringo...
import json, requests, uuid, time, subprocess from datetime import datetime from lxml import etree urls = open('anadarko','r') regexurl = 'company_tagger.xml' target = 'http://localhost:9200/contentmine/fact/' '''try: toremove = requests.get(target + '_search?size=1000000&q=berlin.exact:"yes"').json() print '...
# Generated by Django 2.1.7 on 2019-03-12 14:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('budget', '0010_auto_20190311_1852'), ] operations = [ migrations.AddField( model_name='statement', name='month', ...
import tkinter as tk import unittest import sys import os sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/../../src') from board import Board from pieces.pawn import Pawn from pieces.bishop import Bishop from pieces.king import King from game_state import * class BoardTest(unittest.TestCase): ...
# Question: https://www.hackerrank.com/challenges/coin-change/problem n,m = map(int, raw_input().split()) coins = list(map(int, raw_input().split())) sol = [[0 for x in range(n+1)] for y in range(m+1)] for i in range(1,m+1): for j in range(1,n+1): sol[i][j]+=sol[i-1][j] if j%coins[i-1]==0: ...
#!/usr/bin/python import json, sys, getopt conf = {'tomcat-servers': { 'ansible_ssh_host': '127.0.0.1', 'ansible_ssh_port': 22, # 'ansible_ssh_private_key_file': '~/.vagrant.d/insecure_private_key', 'ansible_ssh_user': 'vagrant', 'ansible_ssh_pass': 'vagrant', 'ansible_sudo': True }} def main(ar...
from turtle import Turtle, done class GeometryTurtle(Turtle): # TODO: Implement me!!! pass def main(): my_turtle = GeometryTurtle() my_turtle.make_square(50) my_turtle.penup() my_turtle.forward(70) my_turtle.pendown() for i in range(6): my_turtle.right(60) my_turtle...
import random from yoolotto.lottery.models import LotteryTicket, LotteryDraw,LotteryCountryDivision from django.views.generic import View from django.http.response import HttpResponse from yoolotto.lottery.tasks import notify_draw_result_all from yoolotto.lottery.enumerations import EnumerationManager from yoolotto.use...
### Author: Lihua Pei (Neo) ### Email: lihua.peidata@gmail.edu ### Created at July 2019 #### Step 1 import Packages ###################################################################################################################################### import pymysql.cursors import time import pandas as pd import n...
#! /usr/bin/env python # -*- encoding: UTF-8 -*- import time from Modules.module import ModuleBaseClass from Applications.RSSNewsHandler import RSSNewsHandler import re class NewsModule(ModuleBaseClass): """ An example module. """ def __init__(self, app, name, pepper_ip): """ Initial...
from BusinessLogicLayer.cluster.master import ActionMasterGeneral class ActionMxCloud(ActionMasterGeneral): def __init__(self, register_url='https://www.mxyssr.me/auth/register', silence=True): super(ActionMxCloud, self).__init__(register_url=register_url, silence=silence, life_cycle=2, ...
import linecache import time def ascii_art(): ascii_art = "ascii.txt" for x in range(0, 7): print(linecache.getline(ascii_art, x), end="") time.sleep(0.1) print("\n")
from time import time start = time() l_dic = {} for i in range(3,1000000): s = i s_list = [s] while s != 1: if s%2 == 0: s = s/2 else: s = 3*s + 1 s_list.append(s) l_dic[i] = len(s_list) print sorted(l_dic.items(), key=lambda x:x[1], reverse = True)[0] p...
class FactorCalculator: def test_factor(x, y): if y % x == 0: return True else: return False #print(test_factor(4, 1024))
from django import forms from django.shortcuts import render, HttpResponse from django.shortcuts import redirect from django.http import HttpResponseRedirect from .models import Details #from .forms import CreateNewList # Create your views here. def index(request): #Getting data from the HTML and accepting ...
"""This example adds a nice status bar to a SketchWindow frame""" import wx from SketchWindow import SketchWindow class SketchFrame(wx.Frame): def __init__(self, parent): wx.Frame.__init__(self, parent, -1, "Sketch Frame", size=(800, 600)) self.sketch = SketchWindow(self,...
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.datasets import load_breast_cancer cancer = load_breast_cancer() type(cancer) cancer.keys() cancer['data'] ty...
"""Given two lists. concatenate them (that is, combine them into a single list). For example, given [1, 2] and [3, 4]: >>> concat_lists([1, 2], [3, 4]) [1, 2, 3, 4] It should work if either list is empty: >>> concat_lists([], [1, 2]) [1, 2] >>> concat_lists([1, 2], []) [1, 2] >>> concat_lists([], []) [] """ def c...
primes = [] for i in range(2,100): for x in range(2,i): if (i % x == 0): break else: primes.append(i) print(primes)
wth = { 0: '晴', 1: '多云', 2: '阴', 3: '阵雨', 4: '雷阵雨', 5: '雷阵雨伴有冰雹', 6: '雨夹雪', 7: '小雨', 8: '中雨', 9: '大雨', 10: '暴雨', 11: '大暴雨', 12: '特大暴雨', 13: '阵雪', 14: '小雪', 15: '中雪', 16: '大雪', 17: '暴雪', 18: '雾', 19: '冻雨', 20: '沙尘暴', 21: '小到中雨', ...
### # Copyright (c) 2013, jbub # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions, and the...
# -*- coding: utf-8 -*- # # Date: 17 September 2018 # Author: Alexandre Frazao Rosario # Patricio Domingues # # Module Full Description: # FDRI is a image analysis module that focus in finding human faces in images, # as well finding images that contain a specific person. It provides this functionality’s app...
# Copyright (c) 2010, James Hanlon, All rights reserved # This software is freely distributable under a derivative of the # University of Illinois/NCSA Open Source License posted in # LICENSE.txt and at <http://github.xcore.com/> import sys import ast from walker import NodeWalker from definitions import * from typed...
# -*- coding: utf-8 -*- """phy main CLI tool. Usage: phy --help """ #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ import sys import os.path as op import re import argparse from textwrap ...
from django.db import models from django.contrib.auth.models import User from jsonfield import JSONField # Create your models here. class FirstClass(models.Model): first_class_name = models.CharField(max_length=100, help_text='一级类目名称', unique=True) cover_path = models.ImageField(upload_to='sjmeigou/goods/fi...
import requests from bs4 import BeautifulSoup import pandas as pd from model import country def getTable(): """Extracting HTML table from worldometers.""" URL = "https://www.worldometers.info/coronavirus/" page = requests.get(URL) soup = BeautifulSoup(page.content, 'html.parser') return soup.find(...