blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
c9bf280be177b8c155da11265353c7322ed6c0e9 | Python | Varvara08/myrepo | /Programm/mix_brush/functions.py | UTF-8 | 19,136 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
#############################
### Some useful functions ###
#############################
#~ A derivative by 7 datapoints
def dervec7(v,h=1):
global f
# Находит производную по 7и точкам
# v - функция, призводную которой ищем
# h - шаг
n=len(v);
f=zer... | true |
20053a4238e8b586606aad19e02bb619482749aa | Python | finesure2017/Labs | /courses/Toronto_ECE410/Lab1/lab1.py | UTF-8 | 1,024 | 3.78125 | 4 | [] | no_license | """
This file is the pre-requisite to the course ECE410: Control Systems at University of Toronto
It is the basics to working with Linear Algebra and Ordinary Differential Equations
"""
import numpy as np
""" Create the matrix
1 2 3
[ 4 5 6 ]
7 8 9
"""
def createMatrix(row, col):
result = np.empty((row, col)... | true |
15a549ecbb0afcfa1da132aaa140fd21c6af0694 | Python | karbekk/Python_Data_Structures | /Interview/FInal_Prep/DSalgo/String/1_String_Rotation.py | UTF-8 | 219 | 3.21875 | 3 | [] | no_license | def rotate(s1,s2):
if len(s1) == len(s2):
s1 = s1 + s1
if s2 in s1:
return True
else:
return False
return False
s1 = 'Karthik'
s2 = 'thikKac'
print rotate(s1,s2) | true |
6516288b6dabc8e14141d32c621b02548bfffb58 | Python | MysteriousSonOfGod/propython | /xml/converter/intelimap2freemind.py | UTF-8 | 1,422 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import sys
from xml.etree import cElementTree as ElementTree
FREEMIND_VERSION = '0.7.1'
if len(sys.argv) == 2:
filename = sys.argv[1]
else:
print 'Usage: %s <InteliMap-text-with-tabs.txt>' % sys.argv[0]
raise SystemExit
def parse_line(line):
parts... | true |
2f9604f6d46542e8e6036beaf1e894fcedc4e8d7 | Python | NardJ/STLViewer | /STLViewer.py | UTF-8 | 9,526 | 2.625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #!/usr/bin/env python3
import sys
import os
import vtk
import numpy
import cv2
# TODO: rotate model does not work nicely if up axis was wrong
################################################
### Print Manual
################################################
print ("STLViewer v0.1 (python3)")
print ("")
print ("Ar... | true |
b1b878f29f30d129696e889547bd442e04c3527a | Python | RapetiBhargav/MyDataSciencePractice | /MyCode/DataVisualization/ScatterPlots.py | UTF-8 | 896 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 3 16:59:39 2020
@author: bhargav
"""
from sklearn.datasets import load_boston
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# Set the palette and style to be more minimal
sns.set(style='ticks', palette='Set2')
# Load data as explained in int... | true |
f8943dd24312bc0f47ea44f446a3d7e226753c57 | Python | jin38895/nn_Scratch | /nn_scratch.py | UTF-8 | 3,077 | 3.765625 | 4 | [] | no_license | # For matrix operations as all input, output and weights are in matrix form
import numpy as np
# Dataset
train_data = np.array([[1,0,1],[1,1,1],[0,1,0],[0,0,0]])
train_labels = np.array([[1,1,1,0]]).T ... | true |
f5bf3381f7b553768293fafc3e9fa718feb7b6d8 | Python | joshuajz/Borg | /courses/database/queens.py | UTF-8 | 1,827 | 2.765625 | 3 | [] | no_license | import json
import requests
from methods.database import Courses_DB
base = "https://api.qmulus.io/v1/courses/"
async def get_info(offset=0):
parameters = {
"limit": "100",
"offset": str(offset),
}
response = requests.get(base, params=parameters)
if response.status_c... | true |
afb4a9cc343f5cff878d7f3efad64a8890a8b94c | Python | KadirCubukcu/DjangoBlog | /image/forms.py | UTF-8 | 865 | 2.5625 | 3 | [] | no_license | from django import forms
from django.utils.translation import ugettext as _
import os
from models import Image
class ImageForm(forms.Form):
image = forms.FileField(label=_('Select an Image File'),
allow_empty_file=False)
def clean_image(self):
"""
Check size, ext a... | true |
c8a510b9f791a4ac9463a3c18e6a892d5b42779b | Python | DanilooSilva/Cursos_de_Python | /Curso_Python_3_UDEMY/banco_dados/criar_grupo.py | UTF-8 | 769 | 2.734375 | 3 | [
"MIT"
] | permissive | from mysql.connector.errors import ProgrammingError
from db import nova_conexao
tabela_grupo = """
CREATE TABLE IF NOT EXISTS GRUPOS(
ID INT AUTO_INCREMENT PRIMARY KEY,
DESCRICAO VARCHAR(30)
)
"""
alterar_tabela_contato_addcampo = """
ALTER TABLE CONTATOS ADD COLUMN IDGRUPO INT
"""
altera... | true |
9e11e69ff4165046ae28eba1763166acc6d3ba34 | Python | daxm/debt_payoff_optimizer | /payoff_debts.py | UTF-8 | 1,611 | 2.59375 | 3 | [] | no_license | #! /usr/bin/env python3
from helper import *
from ruamel.yaml import YAML
import logging
logging.getLogger(__name__).addHandler(logging.NullHandler())
logging_format = '%(asctime)s - %(levelname)s:%(filename)s:%(lineno)s - %(message)s'
logging_dateformat = '%Y/%m/%d-%H:%M:%S'
logging_level = logging.INFO
logging_file... | true |
da347a72e0d2e2f9b901af6ecbd3f9c60546880b | Python | coke-killer/matploblibDemo | /three_circles.py | UTF-8 | 1,435 | 2.5625 | 3 | [] | no_license | # __author__: "yudongyue"
# date: 2021/3/25
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
from matplotlib.gridspec import GridSpec
import os
import shutil
import time
fig = plt.figure(figsize=(15, 5))
# ax_1 = fig.add_subplot(1, 3, 1)
# ax_2 = fig.add_subplot(132)
# ax_3 = fig.add_subplot(133)
... | true |
2fed26f8168b710f672c1ec1c9eb3bd37056ede0 | Python | seoljeongwoo/learn | /algorithm/boj_2159.py | UTF-8 | 557 | 2.8125 | 3 | [] | no_license | import sys
input = sys.stdin.readline
n = int(input())
sx,sy = map(int,input().split())
direction = [(-1,0), (1,0), (0,-1) , (0,1)]
ans = 0
xy = [(sx,sy)] * 5
dist = [0]*5
for _ in range(n):
u,v = map(int,input().split())
new_lst = [(u,v)] + list((u+dx,v+dy) for dx,dy in direction)
new_dist = [int(1e12)+5]... | true |
58da99a85e3826d28bf1fa5f522299bc6532f221 | Python | KimBitrus26/json_formatter_and_validator | /app/models.py | UTF-8 | 770 | 2.625 | 3 | [] | no_license | from app import db, ma
#user model
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key = True)
username = db.Column(db.String(50), nullable=False)
email = db.Column(db.String(100), nullable=False)
password = db.Column(db.String(300), nullable=False)
#constr... | true |
29a6ff9c543ef7ab322707e21cc6dc6dff2fb46a | Python | nyedun22/carbon-crush | /main.py | UTF-8 | 40,675 | 2.984375 | 3 | [] | no_license | from replit import web
import flask
app = flask.Flask(__name__)
#displays home page
@app.route('/')
def index():
return flask.render_template('index.html')
#displays information page
@app.route('/info/')
def info():
return flask.render_template('info.html')
#displays pledge page
@app.route('/pledge/', methods... | true |
823f6f4abc855ce2f4c02f91f6670e71afdcc193 | Python | Dillon2332/Python-Files | /karatechop.py | UTF-8 | 915 | 3.34375 | 3 | [] | no_license | array_of_int = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 100, 1233, 133]
def chop(num, array):
index_val = len(array)
first_half = array[:int(len(array)/2)]
second_half = array[int(len(array)/2):]
print(f"First half: {first_half}")
print(f"Second half: {... | true |
9b8a4622b1c7b1dcca85a0f1a68d0ac5e900e168 | Python | richardvogg/learning-pytorch | /intro.py | UTF-8 | 1,334 | 3.71875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 17 17:46:32 2021
@author: Richard
from: https://pytorch.org/tutorials/beginner/blitz/tensor_tutorial.html
"""
import torch
import numpy as np
import torchvision
#%%
# create a tensor from a list
data = [[1, 2],[3, 4]]
x_data = torch.tensor(data)
#%%
# from numpy arr... | true |
bd5b72cf538c57dd39f300eb30039ccdaf66fec0 | Python | TakamasaIkeda/-100- | /NLP100/chap1/knock00.py | UTF-8 | 74 | 2.84375 | 3 | [] | no_license | stressed = "stressed"
reverse = stressed[len(stressed)::-1]
print reverse
| true |
1b66cde194abf6fe26b5113fb1f74d8726408213 | Python | InbarShirizly/MAFAT-Challenge | /serve_the_model/mafat_api_local.py | UTF-8 | 3,446 | 2.984375 | 3 | [] | no_license | """
flask api for server:
- upload spectorgran track as a pickle file
- predict for each segments using given model
- present results of prediction with spectrograms in a server, along with image of the full track
- history page to present previous spectrograms in the server
"""
from flask import Flask, render_templat... | true |
2f5c0ae9114b1312fc59390fc715907935bcaaf9 | Python | M10307431/Jingho | /WSN_simulation/WSNresult/Main_parse.py | UTF-8 | 4,650 | 2.75 | 3 | [] | no_license | import os
import xlwt, xlrd
def parsefile(path, sheet, col):
row=1
sheet.write(row,col+1,"SetAmount_MeetRatio")
sheet.write(row,col+2,"Missratio_perset")
sheet.write(row,col+3,"Meetratio_perset")
sheet.write(row,col+4,"MissLatency_perpkt")
sheet.write(row,col+5,"MeetLatency_perpkt")
sh... | true |
b1be379d5954967d0604f0fab8211240b4a582b9 | Python | andrewstring/remote-thermometer | /arduino/convert.py | UTF-8 | 1,931 | 3.546875 | 4 | [] | no_license | import collections
class Converter():
def __init__(self, file_name):
self.file_name = file_name
self.data_dict = self.get_calibration(self.file_name)
def get_calibration(self, file_name):
calibration_dict = {}
# open calibration file for reading
with open(self... | true |
c3c47442725c44493ecedf7db35afc322d0109d9 | Python | xwk1993/LearningPython | /basic/2.变量.py | UTF-8 | 66 | 3.390625 | 3 | [] | no_license | name = input('请输入你的姓名:')
print('你好!', name)
| true |
d013f95dadfd457d01158536d7c9e2b559df6a7b | Python | gil9red/SimplePyScripts | /games/tetris/main_console.py | UTF-8 | 8,040 | 2.84375 | 3 | [
"CC-BY-4.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "ipetrash"
import sys
import time
from threading import Thread
from typing import Callable
from asciimatics.effects import Print
from asciimatics.renderers import FigletText, StaticRenderer
from asciimatics.event import Event, KeyboardEvent
from asciimatic... | true |
a564c07bdc5b5cd015e00f5afac4d87efeb5b983 | Python | alexandraback/datacollection | /solutions_2449486_0/Python/pix1gg/b.py | UTF-8 | 1,464 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import os
import sys
import numpy as np
import scipy as sp
import pylab as pl
def perr(errmsg):
sys.stderr.write(errmsg);
def help(prog):
perr("Usage: %s input\n" % prog);
def check_pattern(pattern):
minval = pattern.min();
if minval > 100:
return True;
[N, M] =... | true |
07dfeb10dfad3f5328a3b81e402eeb77397f7928 | Python | ShanjinurIslam/Online-Judge-Problems | /Codeforces/1333B.py | UTF-8 | 886 | 3.140625 | 3 | [] | no_license | t = int(input())
for k in range(t):
n = int(input())
a = list([int(x) for x in input().split()])
prev = [set()]
for i in range(1,n):
s = set()
s.add(a[i-1])
s = s.union(prev[i-1])
prev.append(s)
b = list([int(x) for x in input().split()])
if(a[0]!=b[0]):
... | true |
578e90e0fcb611ec4e4cc43b0162f6adaa94a079 | Python | takin6/algorithm-practice | /at_coder/e869120/03_knapsack_dp/basic/knapsack.py | UTF-8 | 429 | 2.75 | 3 | [] | no_license | N,W = map(int,input().split())
weights = []
vals = []
for _ in range(N):
v,w = map(int,input().split())
weights.append(w)
vals.append(v)
dp = [ [0]*(W+1) for _ in range(N+1)]
for i in range(1, N+1):
wei, val = weights[i-1], vals[i-1]
for w in range(W+1):
if w >= wei:
dp[i][w] = max(dp[... | true |
a270873065ed72f3bc5515099a62dd8903dd639e | Python | RKruizinga/WSD | /customFeatures.py | UTF-8 | 2,469 | 2.609375 | 3 | [] | no_license | import numpy as np
import re
from sklearn.base import BaseEstimator, TransformerMixin
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from sklearn import preprocessing
class CustomFeatures:
class wordCount(TransformerMixin):
def fit(self, X, y=None):
return self
def transform(self, X):
... | true |
911a2ad3bdef879825fdc91e3d52c9762158b634 | Python | chuzcjoe/Leetcode | /1202. Smallest String With Swaps.py | UTF-8 | 936 | 3.15625 | 3 | [] | no_license | class Solution:
def smallestStringWithSwaps(self, s: str, pairs: List[List[int]]) -> str:
graph = collections.defaultdict(list)
ans = []
for i,j in pairs:
graph[i].append(j)
graph[j].append(i)
f = {}
def find(x):
... | true |
1eddc29405c1ed5d18502182413961cc48d8e139 | Python | javacode123/oj | /swordOffer/ugly_num.py | UTF-8 | 649 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019-09-06 16:57
# @Author : Zhangjialuo
# @mail : zhang_jia_luo@foxmail.com
# @File : ugly_num.py
# @Software: PyCharm
# -*- coding:utf-8 -*-
class Solution:
def GetUglyNumber_Solution(self, index):
# write code here
if index == 1:
return 1
... | true |
3226e34f4df893514144999ae5a44dfe5e399a52 | Python | agoncecelia/datascience | /lists.py | UTF-8 | 102 | 3.0625 | 3 | [] | no_license | studentat = ["Agon Cecelia", "Taulant Fisteku", "Agon Cecelia"]
print(studentat)
studentat[2] = "Filan Fisteku"
print(studentat)
| true |
dc50d26b0ff4d2489c59da4897f361472e2527ae | Python | jamesben6688/slgbuilder | /slgbuilder/qpbobuilder.py | UTF-8 | 4,382 | 2.6875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numpy as np
import thinqpbo
from .graphobject import GraphObject
from .slgbuilder import SLGBuilder
class QPBOBuilder(SLGBuilder):
def __init__(self, estimated_nodes=0, estimated_edges=0, flow_type=np.int32, jit_build=True):
"""Creates a helper for creating and solves a maxflow graph using the QP... | true |
e8f8c71667c94fbd5d9ac1c36a5a8b327175fec4 | Python | HVA-FRC-3824/RoHAWKticsScoutingPythonServer | /src/data_models/team_pick_ability.py | UTF-8 | 5,665 | 2.6875 | 3 | [] | no_license | from .data_model import DataModel
from calculators.team_calculator import TeamCalculator
class TeamPickAbility(DataModel):
'''Data about a team's strength as a specific type of pick'''
def __init__(self, d=None):
DataModel.__init__(self)
self.team_number = -1
self.nickname = ""
... | true |
f9dc5d67b1912f6ffc6121bfc6378299e09538b8 | Python | lj72808up/ML_Handcraft | /ml/supervised/LinearRegression.py | UTF-8 | 1,702 | 3.25 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
# 本文实现线性回归预测波士顿房价
import numpy as np
import pandas as pd
def getData():
data = pd.read_csv("../datasets/boston.csv")
m = data.shape[0] # 输入个数
price_raw = data['price'].as_matrix().reshape(m,1)
features_raw = data.drop('price',axis=1).as_matrix()
from sklearn.preprocessing im... | true |
0c22ff54316038be9fd28cb82a393c85ea6f93b6 | Python | Young9235/dev_inyoung | /python/171205/quiz_16.py | UTF-8 | 264 | 3.234375 | 3 | [] | no_license | txt = 'programing is poet'
print(txt.center(40, '@'));
print('is의 위치는 : ' , txt.find('is'))
print('p는 총', txt.count('p'), '번 나옵니다.')
print('*'.join(txt))
print(txt[0:10].split('/') + txt[11:13].split('/') + txt[14:18].split('/'));
| true |
578e7f5601cbf5dfd0d944f8d56e0ee8855a5292 | Python | MetOffice/stylist | /source/stylist/style.py | UTF-8 | 1,926 | 3.125 | 3 | [
"BSD-3-Clause"
] | permissive | ##############################################################################
# (c) Crown copyright 2019 Met Office. All rights reserved.
# The file LICENCE, distributed with this code, contains details of the terms
# under which the code may be used.
###################################################################... | true |
dfe31b382dcc6e33a8fe2f9bd130ebfd711e50f1 | Python | dhoatlin/MemoryManager | /mm.py | UTF-8 | 7,304 | 3.09375 | 3 | [] | no_license | #!/usr/bin/python
from Tkinter import *
from tkFileDialog import *
import math
#line numbers
currentLine = 1.0
totalLines = 0
#page/frame size
pageSize = 512.0
#colors
available = '#82FF86'
taken = '#FF4F4F'
#physical pages
pageFrames = []
#all paging tables
pagingTables = {}
'''--------------------------------... | true |
3918d97e835e80a83a4b232349a2b3b7f412da61 | Python | Namyaasingh/dictionary-saral- | /question8.py | UTF-8 | 145 | 3.546875 | 4 | [] | no_license | details={}
for i in range(10):
user=input("enter the name :")
marks=input("enter the marks:")
details[user]=marks
print(details)
| true |
19bb8209c66e195e7e6720a373ea21976fa40dbf | Python | Erich6917/python_general_py2 | /util/date_check_util.py | UTF-8 | 864 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2018/6/4
# @Author : ErichLee ErichLee@qq.com
# @File : date_check_util.py
# @Comment : 日期类检查工具
#
import datetime
import time
def __curr_time():
print time.time()
print time.localtime((time.time()))
print time.localtime()
print time.strftime("%Y-%m-%d %H:%M:%S... | true |
bf4e838c789428191005e6eec301a29316d4d49c | Python | Ekluv/Recursive-CTE | /recursive_cte_demo/company/networkx_graphs.py | UTF-8 | 477 | 2.78125 | 3 | [] | no_license | import networkx as nx
from company.models import Employee
G=nx.Graph()
G.add_edge(1, 2)
G.add_edge(2, 3)
G.add_edge(3, 4)
G.add_edge(1, 4)
G.add_edge(4, 5)
G.add_edge(3, 5)
nx.shortest_path(G, source=1, target=3)
# [1,2,3]
nx.shortest_path(G, source=1, target=4)
# [1,4]
nx.shortest_path(G, source=1, target=5)
# [1... | true |
1e927dbea0c6b867fbbf13fc76e563c09fc448ad | Python | CorentinAmbroise/brainite | /brainite/models/pmvae.py | UTF-8 | 11,332 | 2.546875 | 3 | [
"CECILL-B"
] | permissive | # -*- coding: utf-8 -*-
##########################################################################
# NSAp - Copyright (C) CEA, 2021
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
#... | true |
f006e0e94ba429d0f9b8e75e3568a7a7796a7f38 | Python | nchlsb/fun_algs_in_python | /is_palindrome.py | UTF-8 | 287 | 3.9375 | 4 | [] | no_license | # There are simpler ways to do this in Python, but this demos an algorithm
def is_palindrome(string):
i = 0
j = len(string) - 1
while i < j:
if string[i] != string[j]:
return False
i += 1
j -= 1
return True
| true |
6199f22651354405069bb5079496faceef6595a9 | Python | pints-team/pints | /pints/tests/test_noise.py | UTF-8 | 7,718 | 3 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
#
# Tests the noise generators
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
import unittest
import numpy as np
import pints.noise as pn
cl... | true |
ba7f0b2b9ccda48f971f0d25411aadd24c53a53f | Python | dronag/Python | /hangman.py | UTF-8 | 1,342 | 3.953125 | 4 | [] | no_license | import random
movies=['Omkara','Rustom','Aandhi','Saagar','Simmba','Sholay','Sarkar','Haider','Baaghi','koi mil gaya']
def choose_word():
word = random.choice(movies)
play_game(word)
def play_game(randomword):
word = list(randomword)
blanks = "_" * len(word)
blanks = list(blanks)
guessed = []
i... | true |
cd9c3fe6f876e9ab0b957abc4453d446bc4c8345 | Python | Farooqut21/my-work | /Detailed assignment 3.16 to 3.44/3.17 TO 3.44/3.42.py | UTF-8 | 84 | 3.28125 | 3 | [] | no_license | #3.42
def avg(lists):
for list in lists:
print(sum(list)/len(list))
| true |
42769f170adddce60ffa4abafff797f7e549b573 | Python | sagarjaspal/Training | /Exceptions/nested_try_except.py | UTF-8 | 248 | 3.234375 | 3 | [] | no_license | a = int(input('Enter a'))
b = int(input('Enter b'))
try:
x = a/b
li = [1, 2, 3, 4]
print('Output:', x)
print(li[8])
except ZeroDivisionError as ze:
print(ze)
except IndexError as ie:
print(ie)
print('Still in running mode')
| true |
c7044b9b4a15f54954bc81c7bb4b9bdecc77bc59 | Python | BenRW/Diploid-CA | /tasks.py | UTF-8 | 5,182 | 2.875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import DCA
import time
import glob, os
def vary_lambda(size, n_iterations, save=True, is_22=True):
l = 0
threshold = 0.01
density = []
l_array = []
n = 0
large_step = False
while l <= 1.04: # 1.04, not 1, in case the code takes a big step ... | true |
3033881459bc2b139ff83303eb96b114cfa63ac1 | Python | k-jinwoo/python | /Ch04/p85.py | UTF-8 | 219 | 3.625 | 4 | [] | no_license | """
날짜 : 2021/04/29
이름 : 김진우
내용 : 실습 단일 리스트 객체 예 교재 p85
"""
# (1) 단일 list 예
lst = [1,2,3,4,5]
print(lst)
print(type(lst))
for i in lst :
print(lst[:i]) # i 전까지 | true |
068fb45ef9943c88baeeaace6c68401f756cfd29 | Python | possientis/Prog | /poly/DesignPatterns/Command/command.py | UTF-8 | 5,980 | 3.671875 | 4 | [] | no_license | # Command Design Pattern
# from https://en.wikipedia.org/wiki/Command_pattern
# In object-oriented programming, the command pattern is a behavioral
# design pattern in which an object is used to encapsulate all information
# needed to perform an action or trigger an event at a later time. This
# information includ... | true |
6b52dd105f8cc649b8ad9ec056606de3202700fc | Python | kragen/shootout | /bench/prodcons/prodcons.psyco | UTF-8 | 1,010 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
# $Id: prodcons.psyco,v 1.3 2007-12-04 06:32:39 bfulgham Exp $
# http://www.bagley.org/~doug/shootout/
import sys, psyco
from threading import *
psyco.full()
access = Condition()
count = 0
consumed = 0
produced = 0
data = 0
def consumer(n):
global count, data, consumed
while 1:
acc... | true |
91b8fa6f367911c39658daed51eb556f18f35813 | Python | thomasmatt88/dataanimation | /videotrim.py | UTF-8 | 2,688 | 2.59375 | 3 | [] | no_license | from hachoir.metadata import extractMetadata
from datetime import datetime
import moviepy.editor as mpe
# custom modules
from videotimestamp import videotimestamp
def trim_start(new_start_time, video_file_path):
#convert new_start_time to datetime object
new_start_time = datetime.strptime(new_start_time, '%Y... | true |
48a4bf5ef07f827810d9d235e43c07bbd8054274 | Python | whtahy/leetcode | /python/0011. maxArea.py | UTF-8 | 394 | 2.890625 | 3 | [
"CC0-1.0"
] | permissive | class Solution:
def maxArea(self, ls):
n = len(ls) - 1
v, left, right = [], 0, n
while 0 <= left < right <= n:
h = min(ls[left], ls[right])
v += [h * (right - left)]
while ls[left] <= h and left < right:
left += 1
while ls[right... | true |
e9b5aab46944b29ff2df06c73fc98cefa8a93a53 | Python | gustavoPu/Algoritmos-de-Buscas | /buscas.py | UTF-8 | 8,324 | 3.171875 | 3 | [] | no_license | import networkx as nx
import matplotlib
import matplotlib.pyplot as plt
import os
matplotlib.use('Agg')
class Buscas(object):
"""
Classe de buscas para utlizar buscas cegas
"""
def __init__(self):
self.initial_node = ''
self.finish_node = ''
self.nodes = {}
self.ed... | true |
5424eb2723587d07c11cab3a888ffe0d092432ae | Python | chof747/awsremote | /src/aws_remote.py | UTF-8 | 5,170 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
# encoding: utf-8
'''
awsremote -- command line program to execute main aws tasks on a project
awsremote is a command line program which performs standard activities on aws
for specific cumbersome tasks like
- generating a snapshot and test image
- starting a test instance
@author: Christ... | true |
ec6c4f411f3a90b4d44cdcd3964e5babbfa858d6 | Python | RagingPolo/proxitable | /citadel/CitBoard.py | UTF-8 | 950 | 3.453125 | 3 | [] | no_license | # ---------------------------------------------------------------------------- #
# CLASS CitBoard
#
# Maintains state of the citadel game board, board consists of 7 positions
# ---------------------------------------------------------------------------- #
class CitBoard( object ):
MIN = 0 # Lowest board position
... | true |
9ac402585c0b139b7a3500e93a5465f7b89cbb97 | Python | dsweed12/My-Projects | /Project II - Python MITx/Midter.py | UTF-8 | 1,624 | 3.671875 | 4 | [] | no_license | def closest_power(base, num):
guess=0
exp=1
while abs(base**guess - num) != 0:
if num > base**guess:
if abs(base**guess - num) <= abs(base**exp - num):
exp = guess
if base**guess > num:
if abs(base**guess - num) < abs(base**exp - num):
... | true |
482677038f67b6d69413b158b36ba02a2cf42e46 | Python | lksdsy/tulingxueyuan | /xuexi/data_type_base/bilibili_shipin.py | UTF-8 | 857 | 3.015625 | 3 | [] | no_license | '''
url = 'https://search.bilibili.com/all?keyword=%E8%A7%86%E9%A2%91&from_source=banner_search&page=3'
'''
import requests
from lxml import etree
def getInfo(start_page,end_page):
headers = {
'User-Agent': 'Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) ... | true |
adb970c03ec395503cba600c6394ff02cebede9e | Python | Rajeev70133/PyPractice | /NearestValueOfAny.py | UTF-8 | 4,202 | 4.0625 | 4 | [] | no_license | # Find the nearest value to the given one.
#
# You have a list of values as set form and need to find the nearest one
#
# For example,we have the following set of numbers:
# 4, 7, 10, 11, 12, 17, and we need to find the nearest value to the number 9.
# If we sort this set in the ascending order, THEN the:
# left: of nu... | true |
9d22b888cd17b28effb22662faf8bf944514e230 | Python | nasseh101/bumble-swiping-bot | /bumble_bot.py | UTF-8 | 1,809 | 2.75 | 3 | [] | no_license | from selenium import webdriver
from time import sleep
from secrets import email, password
class BumbleBot():
def __init__(self):
self.driver = webdriver.Chrome()
def login(self):
self.driver.get("https://bumble.com/")
# Waiting for page to load
sleep(3)
signin_btn = self.driver.find_elemen... | true |
6b2c2abbc67a9e574d5c6770a97d4bbf5716be71 | Python | AaronCheng820/PythonCode | /VerilogTestbenchGen/VerilogTestbenchGen.py | UTF-8 | 7,922 | 2.65625 | 3 | [] | no_license | # ----------------------------------------------------------
# coding=utf-8
# Copyright © 2021 Komorebi660 All rights reserved.
# ----------------------------------------------------------
WRITE_FILE_NAME = 'VerilogTestbenchGen/testbench_module.txt'
READ_FILE_NAME = 'VerilogTestbenchGen/module_port.txt'
TESTBENCH_MODU... | true |
4277407138e9753482b7f5abe50624c2457209bb | Python | AbeHandler/WordNet-Word2Vec | /barcharter_adjusted.py | UTF-8 | 3,541 | 3.078125 | 3 | [] | no_license | """
Bar chart demo with pairs of bars grouped for easy comparison.
"""
import numpy as np
import sys
import re
import math
lines = []
def isIt(s, p):
if len(re.findall(p, s)) > 0:
return True
return False
for line in sys.stdin:
lines.append(line.replace("\n", ""))
def lessThanGreaterThanK(l,... | true |
c14bd8f15d8bb397f883fd9519f71f86da5cd5b4 | Python | keurfonluu/My-Daily-Dose-of-Python | /Solutions/8-two-sum.py | UTF-8 | 524 | 4.125 | 4 | [] | no_license | #%% [markdown]
# You are given a list of numbers, and a target number k. Return whether or not there are two numbers in the list that add up to k.
# Try to do it in a single pass of the list.
#
# Example
# ```
# Given [4, 7, 1 , -3, 2] and k = 5,
# return true since 4 + 1 = 5.
# ```
#%%
def two_sum(l, k):
s = set... | true |
11e8f6d4ca5693fd95bd26eeda5221edf753f6c6 | Python | zhouzhengde/china_stock_calendar | /china_stock_calendar/data.py | UTF-8 | 488 | 3.046875 | 3 | [] | no_license | import csv
import os
from pandas.tseries.holiday import Holiday
# parse holiday.csv
HOLIDAY_FILE = 'holiday.csv'
datafilepath = os.path.join(os.path.dirname(__file__), HOLIDAY_FILE)
reader = csv.reader(open(datafilepath, 'r'))
# take holiday info and set result set.
holiday_set = []
i = 0
for item in reader:
dayS... | true |
25cab9e049ece38932bd015dc8d8fedec94e0fec | Python | Penguinwizzard/w3x-to-vmf | /lib/mpyq/mpyq_compression.py | UTF-8 | 3,608 | 3.375 | 3 | [
"BSD-2-Clause"
] | permissive | import zlib
import bz2
class UnsupportedCompressionAlgorithm(Exception):
def __init__(self, algorithmName, compression_type):
self.name = algorithmName
self.used_algorithms = []
self.compression_type = compression_type
for algorithm in ( ("IMA ADPCM STEREO", 0b10000000),
... | true |
8238c492cf68b24d654fed10c249f8511e0a017a | Python | vijay97bk/PythonProblems | /Functional programs/Distance.py | UTF-8 | 683 | 4.0625 | 4 | [] | no_license | '''
date = '06/04/2021'
modified_date = '07/04/2021'
author = 'Vijay Kshirasagar'
description = 'Write a program Distance.py that takes two integer command-line arguments x and y and
prints the Euclidean distance from the point (x, y) to the origin (0, 0). The formulae to
calculate dis... | true |
afcb628299aee466186629071873af0a34f40c68 | Python | ashjambhulkar/objectoriented | /LeetCodePremium/524.longest-word-in-dictionary-through-deleting.py | UTF-8 | 1,367 | 4.25 | 4 | [] | no_license | #
# @lc app=leetcode id=524 lang=python3
#
# [524] Longest Word in Dictionary through Deleting
#
# @lc code=start
# Let's check whether each word is a subsequence of S individually by "best" order(largest size, then lexicographically smallest.) Then if we find a match, we know the word being considered must be the be... | true |
109d0f872ccd88d9ae0fe14bc17a9fe82b60a123 | Python | fhirschmann/penchy | /penchy/jobs/elements.py | UTF-8 | 5,139 | 2.859375 | 3 | [
"MIT"
] | permissive | """
This module provides the foundation of job elements.
.. moduleauthor:: Michael Markert <markert.michael@googlemail.com>
:copyright: PenchY Developers 2011-2012, see AUTHORS
:license: MIT License, see LICENSE
"""
import logging
from collections import defaultdict
from penchy.compat import path
from penchy.jobs... | true |
530a9001f33f38b0615d1f3b10cf148d1eec01e1 | Python | dheysonmendes/python-blueedtec | /Exercicios/aula06_exercicioss.py | UTF-8 | 4,354 | 4.6875 | 5 | [] | no_license | # Exercícios
# 1. Faça um programa, com uma função que necessite de três argumentos, e que forneça a
# soma desses três argumentos.
def soma(a, b, c):
soma = a + b + c
print(f'A soma é {soma}.')
a = int(input('Digite o primeiro numero: '))
b = int(input('Digite o segundo numero: '))
c = int(input('Digite o... | true |
8321bc22a2bb18c49641473ae4002afbb42e91b6 | Python | quanqinle/my-python | /batch_rename_files.py | UTF-8 | 591 | 3.09375 | 3 | [] | no_license | #coding:utf-8
# 批量重命名文件
import os
def rename_files():
# windows系统,则c:\\mydir
# Linux系统,'/home/quanql/old'
for filename in os.listdir('.'):
if filename[-2: ] == 'py':
#过滤掉改名的.py文件
continue
# 文件名替换规则:去掉空格
name = filename.replace(' ', '')
... | true |
e9e092781ffa2577ba9607735f4a6d9beed71b1b | Python | nashid/iclr2019-learning-to-represent-edits | /diff_representation/asdl/syntax_tree.py | UTF-8 | 13,739 | 2.515625 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | # coding=utf-8
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from collections import OrderedDict
from typing import List, Tuple, Dict, Union
try:
from cStringIO import StringIO
except:
from io import StringIO
import json
from .grammar import *
class AbstractSyntaxNode(object):
... | true |
fe88b213d75297757588b2f5d97ca7f4f741509a | Python | jd2207/pythonSandbox | /ManuFacturingLine/operations/scanSerialNum.py | UTF-8 | 1,108 | 2.71875 | 3 | [] | no_license | import factoryStation, factoryOperation
import utilities
from operations.operationResult import opResultSuccess, opResultAbort
class scanSerialNum(factoryOperation.factoryOperation):
'''Prompt user to scan or enter the serial number'''
def __init__(self, factoryStation):
self.name = 'scanSerialNum'
se... | true |
7cf71ab96a35f0518214710bf74e927410dd92aa | Python | nwilming/decim | /decim/immuno_scripts/tsplot_pupil_triallock.py | UTF-8 | 1,227 | 2.5625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import seaborn as sns
# DATA
df = pd.read_csv('/Users/kenohagena/Documents/immuno/da/decim/g_pupilframes/cpf12_all.csv',
header=[0, 1, 2],
index_col=[0, 1, 2, 3],
dtype=np.float64)
# TRANSFOR... | true |
e0b2d5e6b717a0e6288eee8115a6b760a9da7a2d | Python | lsx0304good/sli0304_crawler | /spider_pracs/request_module.py | UTF-8 | 617 | 2.625 | 3 | [] | no_license | import requests
from fake_useragent import UserAgent
''' POST
url = "https://fanyi.baidu.com/sug"
headers = {
"User-Agent": UserAgent().random
}
data = {"kw": "apple"}
resp: requests.Response = requests.post(url, data=data)
assert resp.status_code == 200
print(resp.content) # byte
print(resp.text) # string
... | true |
ba8a61092e243c45b742e256d6e75afcef52446a | Python | sasakishun/atcoder | /KEYENCE2019/B.py | UTF-8 | 563 | 2.828125 | 3 | [] | no_license | s = list(input())
removed = False
removing = False
for i in range(len(s)):
last = list("keyence")
j = i
while j < len(s):
if s[j] == last[0]:
del last[0]
if not last:
print("YES")
exit()
else:
j += 1
break
... | true |
b6dab730109d83fb8d6053093ae35a50b268a5ee | Python | DerekWeiChao/KeepTalkingAndNobodyExplodes | /mainint.py | UTF-8 | 10,994 | 3.125 | 3 | [] | no_license | import sys
import string
serial = None
parallel = None
batteries = None
on = 1
def intro():
print("Welcome to the Bomb Defusal Manual\n")
input("To continue, press Enter\n")
menu()
def menu():
serial = int(input("Enter the last digit of the serial number: "))
serialVowel = input("D... | true |
2ab782e6b7b94796319aaac4f137dd1c0256661b | Python | whatbeg/DataScienceTools | /src/test/feature_engineeringSpec.py | UTF-8 | 2,321 | 3.140625 | 3 | [
"MIT"
] | permissive | # ==================================
# Author: whatbeg (Qiu Hu)
# Created by: 2017. 5
# Personal Site: http://whatbeg.com
# ==================================
import numpy as np
import src.main.feature_engineering as feng
class feature_engineeringSpec():
def __init__(self):
pass
def binarySearchSp... | true |
e4868979c87b29423279d52db8a9ca79f821c3bf | Python | jinrongchi/MapReduce | /Part2/mapper.py | UTF-8 | 701 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python
"""mapper.py"""
import sys
word_list = []
# input comes from STDIN (standard input)
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
# split the line into words
words = line.split()
word_list.extend(words)
bigrams = [word_list[x:x+2] for x ... | true |
8fe674a7e95c2cb063b6c635a454011b6ccec12d | Python | dicao425/algorithmExercise | /LeetCode/islandPerimeter.py | UTF-8 | 784 | 3.328125 | 3 | [] | no_license | #!/usr/bin/python
import sys
class Solution(object):
def islandPerimeter(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
result = 0
for i in range(len(grid)):
for j in range(len(grid[0])):
if grid[i][j] == 1:
... | true |
87a768d1513bb211b038c9ef191a5e22f29d47fb | Python | patriquejarry/Apprendre-coder-avec-Python | /Module_6/UpyLaB 6.19.py | UTF-8 | 2,025 | 3.859375 | 4 | [] | no_license | import random
MY_PRECIOUS = 1
TRAP = -1
def create_map(size, trapsNbr):
""" fonction qui reçoit deux entiers en paramètres, size, compris entre 2 et 100, et trapsNbr,
de valeur strictement inférieure à size x size, et qui retourne un dictionnaire implémentant comme dans
l’exemple précédent une carte de t... | true |
f2388c100ade206bab2115208ee6d580ba83a942 | Python | tangshenhong/PycharmProjects | /socketExercise/server.py | UTF-8 | 424 | 2.6875 | 3 | [] | no_license | #-*- coding:utf-8 -*-
# @Time :2019/5/28 9:47
import socket
addr=('127.0.0.1',2020)
s=socket.socket()
s.bind(addr)
s.listen(5)
print('服务端进入等待状态')
conn,clientaddr=s.accept()
print('服务端开始服务了')
#1024表示每次最多接受1024个字节
recv=conn.recv(1024)
print('客户端给你发送了:',str(recv,encoding='utf8'))
reply=bytes('hello too',encoding='utf8')
... | true |
e035f7ecdd0dfec2ea85b7366212fdd2ce9f9b23 | Python | dychangfeng/myscripts | /python_scripts/cruciform_DNA5.py | UTF-8 | 4,300 | 2.921875 | 3 | [] | no_license | #!/Users/Yun/anaconda2/bin/python
import re
import sys
import string
import argparse ## adding parameters
import operator ## use for the sorting tabl
from datetime import datetime
start_at=datetime.now()
## take two arguments, the fasta file and the number of processors to use
parser = argparse.ArgumentParser(descript... | true |
c66a26f926168f46890ff516b5df22e5f1999bd4 | Python | thylakoids/sudoku | /sudoku.py | UTF-8 | 9,006 | 3.28125 | 3 | [] | no_license | import unittest
import numpy as np
import copy
def valid_type(type):
if type in (int, np.int, np.int8, np.int16, np.int32, np.int64):
return True
else:
return False
class sudoPoint():
"""point in a sudoku
Possible state of the point in a sudoku.
0 : not sure.
-1: error.
"... | true |
3eea7008891680c6007f5f4f336a5737d3e53e15 | Python | charlesartbr/hackerrank-python | /solved.py | UTF-8 | 792 | 2.984375 | 3 | [] | no_license | import os
def count_solved(path):
solved = 0
for entry in os.listdir(path):
if entry.startswith('.'):
continue
fullpath = os.path.join(path, entry)
if os.path.isdir(fullpath):
if any(file.endswith('.py') for file in os.listdir(fullpath)):
... | true |
4e102e6855e7c6ae24c3ffcd1adb64eafdd7d9eb | Python | Azezl/CodeForces_PY | /Problems_Difficulty_800/I_love_%username%.py | UTF-8 | 302 | 3.453125 | 3 | [] | no_license | n = int(input())
lst = (input()).split()
maxi = int(lst[0])
mini = int(lst[0])
amazing = 0
for i in range(1, n):
if int(lst[i]) > maxi:
amazing = amazing + 1
maxi = int(lst[i])
elif int(lst[i]) < mini:
amazing = amazing + 1
mini = int(lst[i])
print(amazing)
| true |
ead6d4efa3c718f194efb1e24c03fb72dc45aa03 | Python | nsirons/A32_SVV | /main/MOI.py | UTF-8 | 9,782 | 3.109375 | 3 | [] | no_license | from math import pi, sin, cos, atan2, sqrt, radians
def calculate_inertia_rotated_rectangle(width, height, angle):
return (width**3 * height * sin(angle)**2 * 1.0 ) / 12.
def calculate_inertia_circular_skin(radius, thickness):
return (pi * radius**3 * thickness)/2.
def calculate_inertia_steiner(original_ine... | true |
592b57d742a4629d2c4f0f25685e28befca2be7c | Python | umaqsud/taverna-to-pig | /src/main/resources/templates/python_stream.st | UTF-8 | 249 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python
import sys, os, string
for line in sys.stdin:
if len(line) == 0: continue
new_lines = os.popen("<command>" + line).readlines()
striped_lines = [x.strip() for x in new_lines]
print '%s' % (' '.join(striped_lines)) | true |
2f555f0b2e93aee1050b8464230172d3f21dbfdc | Python | NiteshTyagi/leetcode | /solutions/476. Number Complement.py | UTF-8 | 195 | 2.921875 | 3 | [] | no_license | class Solution:
import math
def findComplement(self, num: int) -> int:
nob = int(math.floor(math.log(num)/math.log(2))+1)
return ((1<<nob)-1)^num
| true |
9282dca6ec9ff2899e050223614c6d767f213e1c | Python | Rob-Valdez/threat-analyzer | /threats.py | UTF-8 | 1,808 | 3.984375 | 4 | [] | no_license | # This is a threat analysis tool
def main():
print_header()
threats_list = create_threat()
evaluated_threats_list = evaluate_threat(threats_list)
print_results(evaluated_threats_list)
def print_header():
print('------------------------------------------------------------------')
print(' ... | true |
d28658a3275ceb0e8cc3e2fc6d02e0451047b8bc | Python | mk1107/Python-LAB | /palindrome.py | UTF-8 | 323 | 4.6875 | 5 | [] | no_license | #Ask the user for a string and print out whether this string is a palindrome or not.
s=input("ENTER ANY STRING:- ")
x=len(s)
f=True
for i in range (0,int(x/2)-1):
if(s[i]!=s[x-1-i]):
f=False
break
if(f==True):
print("GIVEN STRING IS PALINDROME")
else:
print("GIVEN STRING IS NOT A PALINDROM... | true |
a69d4f55979adc963d3026b8e1029c616bce3133 | Python | thghu123/python-basic-example | /1105/1105_pm/if_test.py | UTF-8 | 151 | 3.921875 | 4 | [] | no_license | str = input('나이입력:')
age = int(str)
if(age>=20):
print("성인")
elif(age<15):
print("어린이")
else :
print("성인 아님")
| true |
0eef8a6f097d13c67f6c739487d45da798245099 | Python | selvamanikannan/freetest | /num.py | UTF-8 | 65 | 3.09375 | 3 | [] | no_license | st=""
for x in range(10**9):
st+=str(x)
print(st[int(input())]) | true |
824e79d5efb55bd08185f97fbb8a747477d7a096 | Python | ricardo-silveira/grafluence | /tools/preprocessing.py | UTF-8 | 1,497 | 2.65625 | 3 | [] | no_license | import json
import heapq
import contextlib2
def avoid_first_line(file_iterator):
first_line = True
for line in file_iterator:
if not first_line:
yield line
first_line = False
citation_path = "../data/APS/output/graph/citation_graphs/files.json"
#coauthorship_path = "../data/APS/ou... | true |
8ece97a89d94c9ff75b1929d02e94dd14aeaf088 | Python | StatistikChris/football_ai_standalone | /gui.py | UTF-8 | 2,060 | 3.0625 | 3 | [] | no_license | from tkinter import *
from tkinter.ttk import Combobox, Checkbutton
from tkinter import filedialog
from PIL import ImageTk, Image
#from tkinter import Menu
window = Tk()
window.title('welcome to the best program in the world')
# define size of window
window.geometry('1000x800')
# create text label
lbl = Label(wind... | true |
0e8a11c5b5a95929c533597d79ee4f3d037c13e0 | Python | caulagi/shakuni | /app/bets/models.py | UTF-8 | 2,196 | 2.984375 | 3 | [
"MIT"
] | permissive | """
bets.models
Models relating to bets placed
"""
import datetime
from mongoengine import *
from decimal import Decimal
from app.groups.models import Group
from app.users.models import User
from app.matches.models import Match
from app.project.config import CURRENCIES
class GroupMatch(Document):
"""Associate ea... | true |
ccd12b358ea255629733e3381c0f145191364cf8 | Python | DefFoxPy/Codigo-Facilito-Pygame | /introduccion/surface.py | UTF-8 | 270 | 2.90625 | 3 | [
"MIT"
] | permissive | import pygame
import sys
pygame.init()
width = 400
height = 500
surface = pygame.display.set_mode((width, height))
pygame.display.set_caption('Hola Mundo!')
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
| true |
d2b9b7c7f887669aaec7386d2300e360cab3b6b8 | Python | leesein123/python | /웹크롤링/다중페이지검색2.py | UTF-8 | 774 | 2.828125 | 3 | [] | no_license | # coding:utf-8
from bs4 import BeautifulSoup
import urllib.request
import re
for n in range(0,10):
data ='https://www.clien.net/service/board/park?&od=T31&po=' + str(n)
req = urllib.request.Request(data)
data = urllib.request.urlopen(req).read()
page = data.decode('utf-8', 'ignore')
... | true |
f76af92060c8838bb92bba5e951339cb9445a399 | Python | HanKKK1515/PycharmProjects | /运算符.py | UTF-8 | 1,991 | 4.09375 | 4 | [] | no_license | # a = 10
# a +=20 # a=a+20
# print(a)
# print(3>4 or 4<3 and 1==1)
'''逻辑运算
and 并且的意思,左右两顿的值必须都是真,运算结果才是真
or 或者的意思,左右两端有一个是真的,结果就是真,全部都是假,结果才是假
not 非的意思,原来是假,现在是真,非真即假, 非假即真
and or not 同时存在,先算括号,然后算not,然后算and,最后算or
'''
# print(1 < 2 and 3< 4 or 1>2)
# print(1 > 2 and 3 < 4 or 4> 5 and 2 > 2 or 9 < 9) # false
# x or... | true |
9bdf713b59c9e08f6daf8e99b1d05a5763ed6e06 | Python | bhkangw/Python | /python_dictionary_basics_assignment.py | UTF-8 | 1,004 | 4.84375 | 5 | [] | no_license | # Assignment: Making and Reading from Dictionaries
# Create a dictionary containing some information about yourself.
# The keys should include name, age, country of birth, favorite language.
# Write a function that will print something like the following as it executes:
# My name is Anna
# My age is 101
# My country... | true |
d2d44649c3baa3706df1d04de5994d2b56f6ee39 | Python | pushp1997/Energy-Efficient-Task-Scheduling | /hybri_pso_bfo.py | UTF-8 | 11,169 | 2.78125 | 3 | [] | no_license | import random
import csv
import matplotlib.pyplot as plt
import math
rows=[]
with open("tasks.csv", 'r') as csvfile:
csvreader=csv.reader(csvfile)
for row in csvreader:
rows.append(row)
class Tasks:
task_no=0
exec_time=0
a=0.9
b=0.8
def calculateMakespan(task_list):
... | true |
651da363085302e31fb1fbc011e2f31e0e29deca | Python | 00dbgpdnjs/rpa | /2_desktop/3_mouse_action.py | UTF-8 | 1,321 | 3.5625 | 4 | [] | no_license | import pyautogui
# pyautogui.sleep(3) # To move the mouse to the place you want ; To print the pos of the cursor of the place you want with the code just below ; ex) pos of file tap to click
# print(pyautogui.position())
# pyautogui.click(64, 17, duration=1) # Move to the coordinates [file tap] for 1s and click... | true |
a290410537507c8bf38abef2cb24581d637c0f21 | Python | NAMazitelli/CHIKKORITTEN_7.2 | /eb_turno.py | UTF-8 | 1,031 | 2.734375 | 3 | [] | no_license | #! /usr/bin/env python
# Clase Turno, Action, Movimiento, AutoAtaque
# Copyright (C) 2012 EGGBREAKER <eggbreaker@live.com.ar>
from eb_lectormapa import Mapa
class Turno():
ActionList = []
def __init__(self):
self.ActionList = []
def getLastAction(self):
if len(self.ActionList) ... | true |