text
stringlengths
38
1.54M
from office365.runtime.client_value import ClientValue class Location(ClientValue): """Represents location information of an event.""" def __init__(self, displayName=None): """ :param str displayName: The name associated with the location. """ super(Location, self).__init__()...
from bigml.api import BigML api = BigML() source1 = api.create_source("iris.csv") api.ok(source1) dataset1 = api.create_dataset(source1, \ {'name': u'iris'}) api.ok(dataset1) anomaly1 = api.create_anomaly(dataset1, \ {'anomaly_seed': u'2c249dda00fbf54ab4cdd850532a584f286af5b6', 'name': u'my_anomaly_name...
# Generated by Django 3.1.3 on 2020-11-26 06:34 import autoslug.fields from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core', '0006_remove_show_slug'), ] operations = [ migrations.AddField( model_name='show', name='slug'...
class Dog: def eat(self): print("狗吃屎") def sleep(self): print("狗睡觉") 邢凯 = Dog() 邢凯.eat() 邢凯.sleep()
'''全局变量''' X = 11 def g1(): print(X) def g2(): global X X = 22 def h1(): X = 33 def nested(): print(X) def h2(): X = 33 def nested(): nonlocal X X = 44 print(X, id(X)) g2() print(X, id(X)) h1() h2() print(X, id(X))
# Turta Helper for Raspbian # Distributed under the terms of the MIT license. # Python Driver for Maxim DS18B20 Temperature Sensor # Version 1.00 (Initial Release) # Updated: July 14th, 2018 # For hardware info, visit www.turta.io # For questions e-mail turta@turta.io # You'll need to add the following line to the /...
#encoding:utf-8 ''' 定义查询指定终端参数应答消息 ''' from lib.protocol.message.MessageBase import MessageBase from lib.protocol.messagePlateform.ResponseBase import ResponseBase class QueryTheTerminalParam_res(MessageBase,ResponseBase): def __init__(self): super().__init__() #不执行该方法,无法使用父类里面定义的属性 ...
''' CS122 Group Project: COVID-19 and Food Insecurity in Chicago Sophia Mlawer, Mariel Wiechers, Valeria Balza, and Gabriela Palacios This module manages all the sources of data. ''' import covid import food_swamp import acs_data import regress import food_banks import create_databases def run(): ''' Retr...
# -*- coding: utf-8 -*- """ Created on Fri May 8 11:34:44 2020 @author: Eier """ import pymysql connection = pymysql.connect("IP-Adress", "Username", "Password") cursor = connection.cursor() cursor.execute("use mandatory2") #selecting dabase cursor.execute("select * from Observations;") names = [ i[0] ...
import sqlite3 import QueryConstructor import Sync def get_first_word_after_filter(text,filter_name): filter_val = text.split(filter_name) filter_parameters = list() i=1 length = len(filter_val) if length >1: while(i<length): filter_parameters.append(filter_val[i].split()[0]) ...
letters = {} for ch in 'abcdefghij': letters.setdefault(ord(ch) % 3, []).append(ch) print(letters)
def solution(s): se_answer=[] s_list = s.split(' ') for each_list in s_list: another_list = [] for j in range(len(each_list)) : if j %2 ==0 : another_list.append(each_list[j].upper()) elif j % 2 != 0: another_list.append(each_list[j].lower()) se_answer.append(...
from django.shortcuts import render, get_object_or_404, redirect from django.urls import reverse # reverse(문자열, args=튜플) # 문자열에 해당하는 URL별칭을 찾고, 매개변수가 필요한 URL일 경우 args 매개변수에 있는 튜플값으로 자동 매핑 from .models import Question, Choice from django.http.response import HttpResponseRedirect import datetime # 파이썬 내장모듈, 시간정보를...
def forming_teams(players, k): players.sort() n = len(players) ans = 0 for i in range(n-2): left, right = i + 1, n-1 while left < right: if players[i] >= k: break cur_sum = players[i] + players[left] + players[right] if cur_su...
# -*- coding: utf-8 -*- """ Created on Fri Jun 12 14:31:16 2015 @author: Olivier + modif MJL+MR 140316 Modified by Dickson Owuor Sat Feb 23 18:17:35 2019 """ import csv import numpy as np import gc import sys import ntpath from .mbdll_border import * def Trad(fileName): temp=[] with open(fileName, 'rU') a...
from django import db from django.conf import settings from django.core.management.base import NoArgsCommand from data.models import MedianHouseholdIncome4Member import csv # National Priorities Project Data Repository # import_mhi_4_member.py # Updated 6/29/2010, Joshua Ruihley, Sunlight Foundation # Imports Census ...
__author__ = 'anilpa' from pylab import * noise_vars = [0,1,3,5] input_scales = [10,50,100] sizes = [2000] # always even! discontinuity = True stationary = False if discontinuity: func_types = [[1,2],[1,3],[1,4],[2,3],[2,4]] else: func_types = [[1,1],[2,2],[3,3],[4,4]] coeffs = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,...
# -*- coding: utf-8 -*- """ Created on Tue Oct 15 13:05:02 2019 @author: paulo """ #DATA AUGMENTATION import os import cv2 import random import numpy as np import matplotlib.pyplot as plt from keras.preprocessing.image import ImageDataGenerator import os from PIL import Image from skimage.color import...
from django.shortcuts import render from django.views import View import json, datetime from .models import User, Order from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponse from django.contrib.auth import login,logout,authenticate...
from django.db import models class BlogPost(models.Model): """ Keeps track of which blog posts have already been imported from the Posterous site """ posterous_id = models.IntegerField() def __unicode__(self): return 'Posterous Post #{0}'.format(self.posterous_id)
import math y=float(input("Write y")) x=float(input("Write x")) i=(2.33*math.log(math.sqrt(1+(math.cos(y))**2)))/(math.e**y+(math.sin(x))**2) print(i)
from distutils.core import setup setup( name='excel-validation', version='1.0', py_modules=['excel_validation'] )
#!/usr/bin/env python3 """Module for application setup/install This module is pretty standard for python applications that you wish to install via the pip module. It basically lets you do things like "pip install -e ." and "pip install ." """ import setuptools setuptools.setup( name="<%= consoleCommand %>", a...
#!/usr/bin/python # -*- coding: utf8 -*- # prueba para la transferencia de logs desde equipo remoto a local from datetime import date import test_helper from helpers.logging_helper import init_logger import transfer_log init_logger("transfer_log") # vamos a descargar logs para 3 fechas.. day = date.today().replac...
import os, sys, datetime import numpy as np import os.path as osp import albumentations as A from albumentations.core.transforms_interface import ImageOnlyTransform from .face_analysis import FaceAnalysis from ..utils import get_model_dir from ..thirdparty import face3d from ..data import get_image as ins_get_image fro...
''' Given a binary tree, return the postorder traversal of its nodes' values. Example Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [3,2,1]. Challenge Can you do it without recursion? ''' class Solution: def postorderTraversal(self, root): result = [] self.posttraverse(root,...
#*-* coding:UTF-8 *-* ''' Created on 2016��4��21�� @author: xsx ''' import unittest from common import browserClass from common import baseClass import traceback import time from selenium.webdriver.common.keys import Keys #需要引入keys包 base=baseClass.base() browser=browserClass.browser() class createTest(unittest.Test...
import pandas as pd import numpy as np class DataLoader: @staticmethod def load_validation_data(): # load validation data val_data = pd.read_csv("../data/cloze_test_val__spring2016 - cloze_test_ALL_val.csv") print("Labels: ", val_data.columns.tolist()) val_right_ending_nr = val...
import os import pytest import re import subprocess import textwrap import time @pytest.fixture def qs_path(): from bsdploy import bsdploy_path qs_path = os.path.abspath(os.path.join(bsdploy_path, '..', 'docs', 'quickstart.rst')) if not os.path.exists(qs_path): pytest.skip("Can't access quickstart...
# coding=utf-8 # coding: utf-8 import random import codecs from tkinter import * import winsound import time # klasa Nagroda (z niej dziedziczone będą treści nagórd i wartości, które one przyjmują) class Nagroda: # ładowanie bazy pytań o nazwie pytania.txt file_name = "nagrody.txt" nagroda_1 = [] # ...
numbers = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'] hund...
import base import getters ALL_CLASSES= base.BaseIpGetter.__subclasses__() ALL= [x() for x in ALL_CLASSES] def get_ip(): import random remaining= ALL[:] while remaining: getter= random.choice(remaining) try: return getter.get_ip() except base.GetIpFailed: re...
# Copyright (C) 2020 Klika Tech, Inc. or its affiliates. All Rights Reserved. # Use of this source code is governed by an MIT-style license that can be found # in the LICENSE file or at https://opensource.org/licenses/MIT. from configparser import ConfigParser from json import load from os import remove, path, enviro...
import torch import numpy as np import sys, os root_dir = os.path.join(os.path.dirname(__file__),'..') if root_dir not in sys.path: sys.path.insert(0, root_dir) import constants from config import args def convert_kp2d_from_input_to_orgimg(kp2ds, offsets): offsets = offsets.float().to(kp2ds.device) img_pa...
import imp import sys import os import numpy as np import torch import pandas as pd from chemprop.data import get_data, get_data_from_smiles, MoleculeDataLoader,MoleculeDataset from chemprop.utils import load_args, load_checkpoint, load_scalers, makedirs, timeit from chemprop.train.predict import predict from rdkit.C...
#!/usr/bin/env python ''' Algorithms calculating the offer quality with respect to different perspectives ''' import numpy as np def q_extreme(scores): ''' Input: scores - array of unsorted scores 0.7% of scores are expected out of the range between (q1 - 1.5 * iqr) and (q3 + 1.5 * iqr),...
# Generated by Django 2.1.7 on 2019-03-16 18:55 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0006_auto_20190316_1529'), ] operations = [ migrations.AlterField( model_name='vidicap', name='vidicap_model'...
import pytest from puzzles.increasing_decreasing_string import sort_string def test_sort_string(): assert sort_string("aaaabbbbcccc") == "abccbaabccba" assert sort_string("rat") == "art" assert sort_string("leetcode") == "cdelotee" assert sort_string("ggggggg") == "ggggggg" assert sort_string("sp...
#!/usr/bin/env python # coding: utf-8 # In[ ]: import pandas as pd import numpy as np import re import os def alphabetizer(string): #alphabetizes elements within a string st_lst = string.split(';') st_lst = sorted(st_lst) alph = ';'.join(st_lst) return alph def dim_ord(string, d...
import sys import argparse from iclientpy.rest.api.updatetileset import update_smtilestileset, recache_tileset from iclientpy.rest.api.cache import cache_workspace, cache_service def cache_local_workspace(args): d = vars(args) d = dict((k, v) for k, v in d.items() if k in ('username', 'password') or n...
""" * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * """ a=input()+'#' l,b,c=-1,'',[] for i,x in enumerate(zip(a,a[1:])): if x[0]!=x[1]: b+=x[0] c+=[i-l] l=i y=len(b) print([c[y//2]+1,0][y%2==0 or c[y//2]<2 or b!=b[::-1] or any(c[y//2-i]+c[y//2+i]<3 for i in range(1,y//2+1)...
# coding:utf-8 import requests, json, datetime from account.models import Account API_USER = 'shine_forever_test_zFZOBK' # input your apt_user API_KEY = 'su9zZf98O0ooT5i8' # input your spi_key url = "http://www.sendcloud.net/webapi/mail.send_template.json" base_link = "http:127.0.0.1:8000/account/do_verificat...
v = [] impares = [] for c in range(0, 10): x = int(input("Digite o " + str(c+1) + "º número: ")) v.append(x) for c in v: if c % 2 == 1: impares.append(c) print("A média dos números ímpares é: ", sum(impares)/len(impares))
from django.contrib import admin # Register your models here. from notification.models import Notification class NotificationAdmin(admin.ModelAdmin): list_display = ('title', 'sub_title', 'type') search_fields = ('type',) list_filter = ('type',) admin.site.register(Notification, NotificationAdmin)
import sys import json import gzip from tabulate import tabulate def friendly_size(n): return str(n / 1000.) def both_sizes(j): bs = json.dumps(j).encode() return (len(bs), len(gzip.compress(bs))) with open(sys.argv[1], 'r') as f: j = json.load(f) tab = [] (a, b) = both_sizes(j) total_bs ...
import os from juliabox.jbox_util import ensure_delete, make_sure_path_exists, unique_sessname, JBoxCfg from juliabox.vol import JBoxVol class JBoxDefaultConfigVol(JBoxVol): provides = [JBoxVol.JBP_CONFIG] FS_LOC = None @staticmethod def configure(): cfg_location = os.path.expanduser(JBoxCf...
from app import app from domain.Project import Project from domain.ProjectDao import ProjectDao from persistent.ProjectDaoImpl import ProjectDaoImpl import unittest class AppTests(unittest.TestCase): def setUp(self): self.app = app.test_client() self.app.testing = True def test_project(self):...
import mysql.connector import sys from datetime import datetime cnx = mysql.connector.connect( host="localhost", user="root", passwd="", database="todo_app" ) cursor = cnx.cursor() ts = datetime.now() print("Welcome to your todo app!") username = input("May I know your name? ") if username: print(f"What sha...
# Generated by Django 3.0.3 on 2020-03-20 02:45 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('applyapp', '0001_initial'), ] operations = [ migrations.AlterField( ...
from collections import defaultdict, Counter, OrderedDict from nltk import induce_pcfg, treetransforms from nltk.corpus import ptb, treebank from nltk.grammar import CFG, Nonterminal from nltk.parse import ShiftReduceParser from nltk.parse.viterbi import ViterbiParser from torch.autograd import Variable import nltk imp...
import numpy as np import os import pickle import open3d as o3d from collections import OrderedDict from utils import image_utils from utils.transformations import rotation_matrix from action_relation.utils.open3d_utils import read_point_cloud, make_pcd import typing def convert_voxel_index_to_3d_index(xyz_arr, ...
last_letter = 'a' word = input() r = 0 for letter in word: az_direction = abs(ord(letter) - ord(last_letter)) za_direction = 26 - az_direction r += min(za_direction, az_direction) last_letter = letter print(r)
import sys import time import threading import os from mininet.net import Containernet from mininet.link import TCLink from mininet.node import RemoteController, Docker from mininet.cli import CLI from mininet.log import setLogLevel, info PATH_TO_MN = os.path.abspath(__file__).split("mn")[0] sys.path.append(PATH_TO_...
from django.db import models # Create your models here. class Evento(models.Model): nombreES = models.CharField(max_length=150, verbose_name = 'Nombre del evento en español') nombreEN = models.CharField(max_length=150, verbose_name = 'Nombre del evento en inglés') descripcionES = models.TextField(max_lengt...
from pyspark.ml.evaluation import MulticlassClassificationEvaluator from pyspark.ml.regression import RandomForestRegressor from models.utils import create_feature_column def build_random_forest_regressor_model(observation_df, feature_columns): # Create new column with all of the features vector_observation_...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import requests import sys import os import pymysql.cursors DETAIL_URL = "http://cq.122.gov.cn/m/viopub/getVioPubDetail" headers = {'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'} params = {"id":None} connection = pymysql.connect(host="localhos...
''' File: group_grade_filler.py Author: Adam Pah Description: Fills the group grades given the grade from one student to all group members Input: * Canvas grade assignment * Group assignments * The assignment integer ''' #Standard path imports from __future__ import division, print_function import argpars...
# print("Enter your name>", end="") name = input("enter your name>") age = int(input("Your age")) # print("Hello ", name, ".", sep="") print(f"Hello, {name}.") if age < 10: print("Hi") elif 10<=age<30: print("Hello") else: print("Good day")
import sys from ev3dev2.motor import MediumMotor, OUTPUT_A, SpeedPercent MAX_TURN_ROTATION = 6 STEERING_SPEED = 100 current_turn = 0 steering_motor = MediumMotor(OUTPUT_A) def turn_right(): steering_motor.on_for_rotations(speed=-STEERING_SPEED, rotations=1) def turn_left(): steering_motor.on_for_rotations(sp...
from django import forms from abudget.money.models import TransactionCategory class CreateTransactionCategoryForm(forms.ModelForm): class Meta: model = TransactionCategory fields = ('name', 'parent') def __init__(self, budget=None, *args, **kwargs): super(CreateTransactionCategoryFor...
# Generated by Django 3.0.3 on 2020-02-24 18:07 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('contracts', '0004_contract_contract_amount'), ] operations = [ migrations.AddField( model_name='contract', name='con...
# coding=utf-8 import unittest from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import time import os # fitable for page jumping class wait_for_page_load(obje...
#!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib.pyplot as plt import csv import sys, getopt def main(argv): values = [] inputFile = '' try: opts, args = getopt.getopt(argv, "hi:", ["ifile="]) except getopt.GetoptError: print 'learningPlot.py -i <inputfile>' ...
from qualia.nn.modules import Module, Linear from qualia.nn.functions import relu from qualia.optim import * from qualia.util import ReplayMemory import gym class NeuralNet(Module): def __init__(self, in_features, hidden, out_features): super().__init__() self.linear1 = Linear(in_features, hidden)...
# -*- coding: utf-8 -*- from odoo import SUPERUSER_ID from odoo.exceptions import AccessError from odoo.tests import common, TransactionCase class Feedback(TransactionCase): def setUp(self): super().setUp() self.group0 = self.env['res.groups'].create({'name': "Group 0"}) self.group1 = sel...
import unittest import Solution class SolveTestCase(unittest.TestCase): def testConvertInt(self): x = "64630 11735 14216 99233 14470 4978 73429 38120 51135 67060" actual = Solution.convertInt(x) excepted = [64630, 11735, 14216, 99233, 14470, 4978, 73429, 38120, 51135, 6...
from macropy.core.macros import * from macropy.core import * macros = Macros() def u(tree): """Stub to make the IDE happy""" def name(tree): """Stub to make the IDE happy""" @Walker def _unquote_search(tree, **kw): if isinstance(tree, BinOp) and type(tree.left) is Name and type(tree.op) is Mod: ...
# -*- coding: utf-8 -*- """ The MIT License (MIT) Copyright (c) 2020 James Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, co...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayIserviceCognitiveClassificationObjectQueryModel(object): def __init__(self): self._biz_code = None self._city_code = None self._cognition_content = None self...
# brain data import os from joblib import Parallel, delayed import pandas as pd import pickle from time import time import numpy as np from smtr import STL, Dirty, MLL, utils, AdaSTL, MTW, ReMTW from build_data import build_coefs, build_dataset from smtr.model_selection import (best_score_dirty, ...
from MAST.structopt.tools import get_best from MAST.structopt.switches import selection_switch from MAST.structopt.switches import lambdacommamu from MAST.structopt.tools import remove_duplicates import logging import random import pdb def predator_switch(pop,Optimizer): """Function for removing individuals from t...
# -*- coding: utf-8 -*- def break_words(stuff): """Wyodrębnienie słów według zadanego separatora""" words = stuff.split(' ') return words def sort_words(words): """Sortowanie słów""" return sorted(words) def print_first_word(words): """Zdjęcie (pop) pierwszego słowa i wypisanie go""" word = words.pop(0) re...
try: t= int(input()) while t>0: t -= 1 n = int(input()) # i = 1 # while i<n: # i += 1 # n -= 1 print(n//2+1) except: pass
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class ItemPrizeInfo(object): def __init__(self): self._item_can_exchange = None self._item_code = None self._item_icon_url = None self._item_name = None self._it...
# -*- coding: utf-8 -*- """ __init__.py file for epaModules module. Defines the __all__ modules. """ __all__ = ["dateconvert"]
from scipy.io import loadmat import torch import numpy as np def data_generator(dataset): if dataset == "JSB": print('loading JSB data...') data = loadmat('./mdata/JSB_Chorales.mat') elif dataset == "Muse": print('loading Muse data...') data = loadmat('./mdata/MuseData.mat') ...
############################################################################### # Copyright (c) 2019-2020 Qualcomm Technologies, Inc. # All Rights Reserved. # Confidential and Proprietary - Qualcomm Technologies, Inc. # # All data and information contained in or disclosed by this document are # confidential and proprie...
import pytest import io from unittest import mock from salvo.util import get_server_info, print_server_info, resolve @mock.patch("salvo.util.request") def test_print_server_info(request): request.return_value = {"headers": {"server": "Super"}} headers = {"one": "two"} stream = io.StringIO() info = ge...
""" This unit test checks that openconn() waits for socket cleanup. """ #pragma repy restrictions.default dylink.repy librepy.repy # Get the IP address of intel.com intel_IP = gethostbyname("intel.com") intel_port = 80 localip = getmyip() localport = libsocket.get_connports(localip)[0] # Connect to intel sock = openc...
from datetime import datetime from pulsar.api import BadRequest, Http401, PermissionDenied, Http404 from sqlalchemy.exc import StatementError from sqlalchemy.orm import joinedload from lux.core import AuthenticationError, AuthBackend as AuthBackendBase from lux.utils.crypt import create_uuid from lux.utils.auth impo...
import xml.etree.ElementTree as ET from os.path import join, isfile from os import listdir xmlpath='c:/Xmls/' xmlslist=[join(xmlpath, f) for f in listdir(xmlpath)] print('Found xml files:', xmlslist) def getdata(xml,classname, name, rawsearch=None): with open(xml, 'r') as x: data = x.read() root = ET....
import hvac from cloudfoundry_client.client import CloudFoundryClient import os import json import environ import requests from dotenv import load_dotenv load_dotenv() VAULT_URL = os.getenv("VAULT_URL") VAULT_TOKEN = os.getenv("VAULT_TOKEN") PAAS_ENV = os.getenv("PAAS_ENV") PAAS_NAMESPACE = os.getenv("PAAS_NAMESPACE")...
from django.shortcuts import render,render_to_response,redirect from django.http import HttpResponseRedirect,HttpResponse from mainsite.forms import UserForm,CustomerForm from mainsite.models import User from django.template import loader from django.contrib.auth import authenticate,login ,logout from django.contrib.au...
from django.urls import path from django.contrib.auth import views as auth_views from . import views urlpatterns = [ path('profile/<str:username>', views.profile, name='profile'), path('update_profile', views.update_profile, name='update-profile'), path('update_profile_pic', views.update_profile_pic, name=...
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) n, q = map(int, input().split()) query = [0] * q for i in range(q): query[i] = list(map(int, input().split())) parent = [0] * n for i in range(n): parent[i] = i def root(n): if parent[n] == n: return n else: # 経路圧縮なし...
import struct import gevent import gevent.ssl as ssl from gevent.queue import Queue from gevent.socket import * import message class APNSPushSessionPool(object): def __init__(self, addr, key_file, cert_file): self._connection_queue = Queue() self._addr = addr self._key_file = key_file ...
from collections import defaultdict from itertools import combinations from typing import List, Dict, Optional, Tuple, Set import sys from graphviz import Digraph import uuid class Graph: adj: Dict['Node', Set['Node']] def __init__(self): self.adj = defaultdict(set) def add_node(self,...
# while 무한 반복 # end : print 출력 내용 후 처리...ex) 개행 탭 등.. # end=""는 원래 print 함수 자체는 개행을 처리하는데 개행을 없애기 위해서 사용됨 while True: print(".", end="")
lista = [1,2,3,4,5,6] for indice, valor in enumerate(lista, 10): print("indice:", indice, "valor:" valor)
import json import geopandas from ..graph import Graph from ..updaters import compute_edge_flows, flows_from_changes from .assignment import get_assignment from .subgraphs import SubgraphView from ..updaters import cut_edges class Partition: """ Partition represents a partition of the nodes of ...
import apache_beam as beam from apache_beam.io import ReadFromText from apache_beam.io import WriteToText from apache_beam.options.pipeline_options import PipelineOptions def run(): pipeline_options = { 'project': 'serious-mariner-255222', 'staging_location': 'gs://mybucket20b40d8c/staging', ...
#!/usr/bin/env python # coding: utf-8 # # ECE/CS 434 | MP3: AoA # <br /> # <nav> # <span class="alert alert-block alert-warning">Due March 28th 11:59PM 2021 on Gradescope</span> | # <a href="https://www.gradescope.com/courses/223105">Gradescope</a> | # <a href="https://courses.grainger.illinois.edu/cs434/...
#!/usr/bin/python enc = "3-33-555-33-8-33 999-666-88-777 22-2-7777-44 44-444-7777-8-666-777-999" dec = "delete your bash history" print dec
# _*_ coding: utf-8 _*_ __author__ = 'Nana' __date__ = '2018/6/13 23:00' # 三元表达式 在lambda用的比较多 # 表达式版本的if else语句 # if else条件控制语句 表达式这样简洁的概念来实现条件控制语句 # 根据x y的大小,最终决定返回的结果 x大于y取x, x小于y取y # 其他语言,三元表达式的编写: # x > y ? x:y ?是如果 意义:问号前面是判断语句,如果x大于y,返回x, 否则返回y # python 三元表达式 # 条件为真时返回的结果 if 条件判断 else 条件为假时的返回结果 # x if x > y...
from math import sqrt, floor, ceil, log def isPalindrome(num): tmp = num digits = [] while tmp > 0: digits.append(tmp % 10) tmp = tmp / 10 l = len(digits) for i in range(0, int(ceil(l/2.0))): if digits[i] != digits[l-i-1]: return False return True def creat...
# -*- coding: utf-8 -*- # Generated by Django 1.11.1 on 2017-08-01 12:34 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('data_management', '0015_auto_20170801_1217'), ] op...
#!/usr/bin/env python3 #10x10 -> 1-10; A-J import collections import random import re import argparse from classes.Color import Color from classes.Statistics import Statistics from classes.GameField import GameField from classes.Winning import Winning from util.GlobalConstants import GlobalConstants from util.Globa...
from flask.ext.restless import APIManager from flask.ext.restless import ProcessingException # JWT imports from datetime import timedelta from flask_jwt import JWT, jwt_required, current_user from boilerplate_app import app from .models import db, user_datastore, User, Protected def is_authorized(user, instance): ...
f = open('data.txt', 'w') f.write('Hello\n') f.write('World\n') f.close() f1 = open('data.txt') text = f1.read() print(text) print(text.split()) f1.close() data = open('data.txt', 'rb').read() print(data) print(data[4:8])
#!/usr/bin/python # David Newell # sebastian/savedata/remove.py # Handle and deleted selected data # Import Useful Modules import sys, os sys.path.append(os.path.abspath('../')) import GeoUtils BASE_URL = GeoUtils.constants.BASE_URL DBhandle = GeoUtils.RDB() DBhandle.connect('uws_ge') # Handle data # db - dictiona...