blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 545k | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 545k |
|---|---|---|---|---|---|---|
978a43d18880d315d2ae9cf47b5952ad6bde48f0 | mateuszm21/PwjsPiLB | /in_out/zapis_danych.py | 301 | 4.03125 | 4 | print("Enter new key please")
org_key = str(input())
correct_key = False
while correct_key is False:
print("Enter key:")
key = str(input())
if key != org_key:
print("Key is incorrect!")
if key == org_key:
print("Correct key!")
correct_key = True
|
892c6518f5cd2648b1279998c02168a4c1a00214 | parkjungkwan/telaviv-python-basic | /intro/_12_iter.py | 848 | 4.3125 | 4 | # ***********************
# -- 이터
# ***********************
'''
list = [1,2,3,4]
it = iter(list) # this builds an iterator object
print (next(it)) #prints next available element in iterator
Iterator object can be traversed using regular for statement
!usr/bin/python3
for x in it:
print ... |
1da043148d67cf94f0706d8d22142813e3f36f23 | parkjungkwan/telaviv-python-basic | /chapter_1/money.py | 424 | 3.625 | 4 | class Money:
def __init__(self):
pass
def main(self):
money = input('총액을 입력하세요\n')
amount = int(money)
if amount <100 :
discount = amount * 0.05
print("5% 할인금액",discount)
else :
discount = amount * 0.1
print("10% 할인금액 ",dis... |
85412355c70bd3b6320a0f7a97c117dbd26ba0cf | parkjungkwan/telaviv-python-basic | /intro/_08_break.py | 579 | 4.0625 | 4 | # ***********************
# -- break 문
# ***********************
for letter in 'Python': # First Example
if letter == 'h':
break
print ('Current Letter :', letter)
var = 10 # Second Example
while var > 0:
print ('Current variable value :', var)
var = var -1
i... |
42fec10e097a866252347e5358f87240702b6152 | gabrielarod35/fun-house-code | /CarlaAgu/funhouseHW.py | 10,856 | 4.0625 | 4 | #funhouse homwork game
def carlasroom(name):
print("Welcome to my room of the fun house dear", name)
print("In order to make it out you need 20 star points to exist!")
print("No more fooling around with introductions now lets start the fun!")
print()
print()
print("How about we start with... |
cb5541aa4b951c264e0dc3f172fd00b47d37772f | anketlale/Machine_Learning | /1.Regression/2. startup profilt prediction/Regression_Problem1_startup_profile_prediction.py | 1,006 | 3.59375 | 4 | # import
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset=pd.read_csv('C:/Users/Anket Lale/Desktop/Machine Learning A-Z/Part 2 - Regression/Section 5 - Multiple Linear Regression/50_Startups.csv')
print(dataset)
x=dataset.iloc[:,:-1]
y=dataset.iloc[:,4]
print(x.shape)
print(y.shape)
y=... |
a2b6fa4938524a624ef932422809b4912751b9f0 | Zeen-Chonlasit/Basic-python-language | /python03.py | 346 | 3.859375 | 4 | a = 10*2/3*1.5-2 # Ex1
#print(type(a)) #สำคัญต่อการทำความเข้าใจ
a = int(a)
#print(type(a))
print(a)
b = 10*2 # Ex2
#print(type(b))
b = float(b)
#print(type(b))
print(b)
c = 2.97 >= 2.00
print(type(c))
d = "วทบ. เทคโนโลยีสารสนเทศ"
print(type(d)) |
74cb106a13e37bfb0cf94bc5fb428d8a057aaa25 | brennuck/Intro-Python-II-2 | /src/adv.py | 3,221 | 3.828125 | 4 | from room import Room
from player import Player
from item import Item
# Declare all the rooms
room = {
'outside': Room("Outside Cave Entrance", "North of you, the cave mount beckons"),
'foyer': Room("Foyer", """Dim light filters in from the south. Dusty passages run north and east."""),
'overlook': Ro... |
292249d766725ab81a4290432f21872083ee00ad | shaswataddas/Basic-ImportantProblrm | /GCDofTwoNum.py | 221 | 3.71875 | 4 | #GCD of two Number.
a = int(input("Enter a number: "))
b = int(input("Second number: "))
result = 1
a = min(a,b)
for i in range(a,0,-1):
if a%i==0 and b%i==0:
result = i
break
print(result) |
1492384830bd72bf17727baa6e308ba454e40df0 | FPlatz95/HelloPython | /hunt_the_wumpus.py | 4,561 | 4.28125 | 4 | #!/usr/bin/env python3
#Importing packages
from random import choice
#Defining functions
## Convenience functions
def create_tunnel(cave_from, cave_to):
""" Create a tunnel between cave_from and cave_to """
caves[cave_from].append(cave_to)
caves[cave_to].append(cave_from)
def visit_cave(cave_number):
... |
88e5f9682851dcbaedd5d6050eed4d6e642b8000 | cgabhane/python-test | /python-test/programs-codedopes/bcd.py | 384 | 3.703125 | 4 | '''
Created on Sep 28, 2016
@author: cgabhane
'''
print "Enter age"
a=input()
print "Enter M/F"
b=raw_input( )
print "Marital staus (Y|N)"
c=raw_input( )
if b == "F" and a>=20 and a<=60:
print "Urban areas only"
elif b=="M" and a>=20 and a<=40:
print "work anywhere"
elif b=="M"and a>=40 and a<=6... |
a8dd5ef80deb66d91024aa057b137da3e022196e | notthetup/funwithasync | /client.py | 2,498 | 3.625 | 4 | #/bin/env python
#
# An example solution for the excercise in Python.
#
# Dependencies are:
# httpx : pip install httpx
#
import httpx
import asyncio
import urllib.request
import time
def exercise0() :
print("--------Exercise 0----------------")
start = time.time();
data = urllib.request.urlopen("http://l... |
25c6481e0c5f7a845e3d69f796cf8335f5508645 | Houchangxi/houchangxi.github.ai_numpy | /data_analysis/data_aggregation_and_group_operation.py | 1,328 | 4 | 4 | import pandas as pd
import numpy as np
df = pd.DataFrame({'key1' : ['a', 'a', 'b', 'b', 'a'],
'key2' : ['one', 'two', 'one', 'two', 'one'],
'data1' : np.random.randn(5),
'data2' : np.random.randn(5)})
print(df)
grouped = df['data1'].groupby(df['key1'])
print(... |
72e284731afe4208c8f00554ad8342f730d6b9cb | Sumit-daniel/Company-attrition-rate-Analysis-by-LR-balanced-Data-Set-Randam-Forest | /Sumit Daniel Capstone Codes.py | 4,501 | 3.53125 | 4 | #Library section
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from sklearn.preprocessing import MinMaxScaler
from sklearn.linear_model import LogisticReg... |
bb0e52eb4f86f33217c969fef3fff013d02d8916 | wongstein/neural_networks | /library/classification.py | 8,651 | 3.578125 | 4 | from keras.models import Sequential
from keras.layers.core import Dense, Activation
from keras.utils import np_utils
import numpy as np
import database
class classification():
def __init__(self):
self.model = Sequential()
def train_with(self, training_data_list, answers):
#put data in right fo... |
e9c85ba486ad4cd03a12b340946d70e6012cb4d1 | pichiu/codility_lessons | /L04_Counting_Elements/MissingInteger.py | 384 | 3.53125 | 4 | # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
# https://app.codility.com/demo/results/training9QTF9R-SHK/
def solution(A):
# write your code in Python 3.6
nums = sorted([num for num in A if num > 0])
prev = 0
for num in nums:
if num - prev > 1:
... |
111a4398a7183f06f4e9d42d2a329d09a335d140 | pichiu/codility_lessons | /L04_Counting_Elements/FrogRiverOne.py | 405 | 3.625 | 4 | # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
# https://app.codility.com/demo/results/trainingWREQUC-CKY/
def solution(X, A):
# write your code in Python 3.6
nums = set([i for i in range(1, X+1)])
for i, num in enumerate(A):
if num in nums:
n... |
e16d0fd265b04350fbe15bfd158fd677966a1f65 | alvinxu1988/MIT-6.0001 | /ps1c.py | 1,334 | 4.03125 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 10 13:27:45 2021
@author: AlvinXu
"""
#Initializing state variables
total_cost = 1000000
portion_down_payment = 0.25
down_payment = total_cost*portion_down_payment
current_savings = 0.0
r = 0.04
semi_annual_raise = 0.07
portion_saved = 0.0
total_mo... |
a11d8afa1f3a079cd4d0a7a4356a7ffaafa86d73 | martin-crdev/Curso-de-Python-Intermedio | /list_comprehensions.py | 553 | 3.84375 | 4 | def run():
#
# squares = [] creamos una lista vacia
# for i in range(1, 101): creamos in ciclo for que incremente del 1 al 100
# if i % 3 != 0: si i modulo 3 es distinto a 0 es decir que no es divisble entre 3
# squares.append(i**2) añade a la lista el cuadrado de ... |
8561fea870a9b5349983d5432a1cca9d89edd684 | 161REB107/x161REB107 | /public_html/228.py | 1,507 | 3.703125 | 4 | # -*- coding: utf-8 -*-
#print ("Ievadi trīsstūra leņķi alfa!\n")
#a=input("Ievadi trīsstūra leņķi alfa!\n")
from math import sin, pi, sqrt
while True:
result = input("Ievadi trīsstūra leņķi alfa robežās no 1-89:\n")
if 1 <= int(result) <= 89:
print "Leņķis ir %d grādi" %result
d= int(result... |
8bff7f2f392ee84bab99186ba692869357c591f4 | petrucciii/python-examples | /question game/python quiz.py | 1,768 | 3.984375 | 4 | #by petrucciii
#try again
try_again = "Yes"
while try_again == "Yes":
class PythonQuiz():
#title
print("Python Quiz")
#first question
def first_question():
print("First Question")
question_1 = input("Who made python? ")
if qu... |
557b5d8f12b52e23bb156317c0a917c47e202560 | edgeerrol87/pc-remote | /server.py | 2,128 | 3.578125 | 4 | # first of all import the socket library
import socket
import pyautogui
import io
# next create a socket object
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print("Socket successfully created")
# reserve a port on your computer in our
# case it is 12345 but it can byte anything
port = 20001
#... |
c475ddbbb6e08c63b4b797c0f43bc9a28c1b97ce | Aalekseika/python_hw | /hw#19.py | 385 | 3.78125 | 4 | #вывести на экран все простые числа от 1 до 100
import math
def primes():
for i in range(2,101):
for k in range(2,i):
if k>int(math.sqrt(i)):
print(i)
break
elif i%2==0:
break
elif i%k==0:
break
else... |
3e75558482ffeed57b5a619ddf516967bb92f70e | Helbros72/targilim | /targil_page_26_19.py | 97 | 4.15625 | 4 | num = int(input("please enter number: "))
x = 1
for i in range(1,num+1):
x = x * i
print(x) |
7f3735ec3008d66405569e12d9f4f53a82c6c3bb | flashfinisher7/ML_Fellowship | /Week2/Sets/Program2.py | 475 | 3.71875 | 4 | from utility.UtilityClass import Utility
class Iterate:
def __init__(self):
self.util = Utility()
def iterate_num(self):
num_set = set([0, 1, 2, 3, 4, 5])
self.util.iterate_set(num_set)
# print(iterate_new_set)
iter_obj = Iterate()
iter_obj.iterate_num()
# .................. |
1abeec74b3bcab371f161043a72c9e408bfe0315 | flashfinisher7/ML_Fellowship | /Week2/List/Program13.py | 152 | 3.953125 | 4 | fruit = ["apple", "banana", "cherry"]
print("original fruit list:", fruit)
fruit.append("strawberry")
print("added fruit in new fruit list:", fruit)
|
6fdf15e7a0befcff0481f082b537d8711f1a77ea | flashfinisher7/ML_Fellowship | /Week2/String/Program6.py | 75 | 3.859375 | 4 |
str1 = input("Enter the string:")
print(str1.upper())
print(str1.lower())
|
af76f67e2462b20c5d37e679f3ea15411a6e55b8 | flashfinisher7/ML_Fellowship | /Week4/Numpy/AppendValues.py | 217 | 3.90625 | 4 | import numpy as np
original_array = [10, 20, 30]
print("original array:=", original_array)
Append_array = np.append(original_array, [40, 50, 60, 70, 80, 90])
print("Append values into original array:=", Append_array)
|
3d629129d7f9894ecbcbf5864ef4d765dcfd4d54 | flashfinisher7/ML_Fellowship | /Week4/Pandas/AddSubtractDivisionMultiply.py | 334 | 3.96875 | 4 | import pandas as pd
df = pd.Series([2, 4, 6, 8, 10])
df1 = pd.Series([1, 3, 5, 7, 9])
df2 = df + df1
print("Add pandas two series:=""\n", df2)
df2 = df - df1
print("Subtract pandas two series:=""\n", df2)
df2 = df * df1
print("Multiply pandas two series:=""\n", df2)
df2 = df / df1
print("divided pandas two series... |
75f7fbe0918a6721112ecdb243a49a7417689c4d | flashfinisher7/ML_Fellowship | /Week2/Tuple/Program9.py | 225 | 3.84375 | 4 | tuple_list = (2, 4, 3, 5, 4, 6, 7, 8, 6, 1)
print(tuple_list[0:])
print(tuple_list[:])
print(tuple_list[2:4])
print(tuple_list[1:3])
print(tuple_list[:4])
print(tuple_list[:-1])
print(tuple_list[:-4])
print(tuple_list[-3:])
|
6e4533d55a44122e3af0c2e2fd7601d91ce46941 | flashfinisher7/ML_Fellowship | /Week2/String/Program11.py | 68 | 3.8125 | 4 | str1 = "I am in office"
print(str1)
str2 = str1[::-1]
print(str2)
|
9615c026e6e547750b65981e7fe2bcc4aa7e330b | flashfinisher7/ML_Fellowship | /Week2/String/Program10.py | 105 | 4.09375 | 4 | str1 = "Hello,How are you!"
substring_str = "H"
str_count = str1.count(substring_str)
print(str_count)
|
46c1394ba2e102de7050a75f904c712f51ab284f | flashfinisher7/ML_Fellowship | /Week4/Numpy/create3DArray.py | 593 | 3.703125 | 4 | import numpy as np
def get_pattern(matrix, row, col):
# iterate over rows
for r_count in range(0, row):
# iterate over cols
for c_count in range(0, col):
# if row 1 or more and col less than row print 1
if r_count > 0 and c_count < r_count:
print("1", en... |
7fa93f3df061d3b79c3ffb9aad61630ce82beeac | flashfinisher7/ML_Fellowship | /Week3/LinearAlgebra/InverseMatrix.py | 717 | 3.5625 | 4 |
from Week3.LinearAlgebra.UtilityClass.UtilityClass import Utility
class InverseMatrix:
def __init__(self):
self.util = Utility()
x = [[12, 7, 3],
[4, 5, 6],
[7, 8, 9]]
def inverse_matrix(self):
try:
print("Original Matrix : ")
for v in range(len... |
528856b36473963985ab8159cff45a36d29194fa | flashfinisher7/ML_Fellowship | /Week2/String/Program8.py | 160 | 3.5 | 4 | str1 = 'https://www.w3resource.com/python-exercises/string'
s = str1.rsplit('/', 1)
print(s[0])
print(s[1])
s1 = str1.rsplit('-', 1)
print(s1[0])
print(s1[1])
|
1e818ae0aba3cd42b2701413efaf80b78ab29fb6 | flashfinisher7/ML_Fellowship | /Week4/Numpy/AddExtraColumnToAnNumpyArray.py | 121 | 3.578125 | 4 | import numpy as np
x = np.array([[10, 20, 30], [40, 50, 60]])
y = np.array([[100], [200]])
print(np.append(x, y, axis=1)) |
4ca6e855fead5bae828262c389a1f2e356310560 | meghana-singh/advent-of-code-2020 | /day2/two.py | 545 | 3.59375 | 4 | import csv
with open('input.csv') as f:
reader = csv.reader(f, delimiter=' ')
pwd_policy = {}
count = 0
for row in reader:
l = int(row[0].split('-')[0])
u = int(row[0].split('-')[1])
letter = row[1].split(':')[0]
indexes = [i+1 for i, char in enumerate(row[2]) if char == ... |
4543dae608330489ccc78f269805a6c8ae07015e | MRE-Code-Hub/tsdat | /tsdat/utils/converters.py | 4,133 | 3.609375 | 4 | import abc
import numpy as np
import pandas as pd
from act.utils import data_utils
class Converter(abc.ABC):
"""Base class for converting data arrays from one units to another.
Users can extend this class if they have a special units conversion
for their input data that cannot be resolved with th... |
6de97eb60904cee23ae07060f6f10466f1d07223 | Savomagia/my_adventure_game | /main.py | 3,662 | 3.953125 | 4 | def adventure():
# do work
return play_again()
def play_again():
paths = ["North", "South", "East", "West"]
life = 5
moves_1 = 1
moves_2 = 1
moves_3 = 1
wall = "SBAM. You hit a wall and you feint again."
mud_pond = "PLOP! You are covered in Mud!"
water = "Splash. Fantastic, you... |
eaae699afb15ebac7069895a5424738ad3ca5e97 | maurus56/exercism | /python/reverse-string/reverse_string.py | 145 | 3.78125 | 4 | def reverse(input=''):
"""With extended slicing
string[start:end:step]
"python"[3::] = "hon"
"""
return input[::-1] |
e1c7966629447646a79354b158d5573af6c8b54f | scities/metro-atlas_2014 | /bin/counts/cbsa_population.py | 882 | 3.5625 | 4 | """cbsa_population.py
Script to compute the total number of households there is per CBSA.
"""
import csv
## Import the list of MSA
msa = {}
with open('data/names/cbsa_names.txt', 'r') as source:
reader = csv.reader(source, delimiter='\t')
reader.next()
for rows in reader:
msa[rows[0]] = rows[1]
... |
f86fa6be3b5e794b815b594b81528a3fdaf53e34 | Darkkyelfo/Tetris-PyQt | /Peca.py | 5,849 | 3.5625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 30 12:45:38 2015
@author: Raul
"""
import random
#Classe responvel por modelar tretraminos através de matrizes
class Peca():
tipo=None
rotacao = None#indica a rotação atual
rotacaoMax=None#indica o número máximo de rotações suportadas
maiorY=0#armazena o ... |
0bf46c11547325b7fab69cca5a9479ef97fcf305 | mpearmain/gestalt | /examples/breast_cancer_binary.py | 5,105 | 3.75 | 4 | """
Breast Cancer example of usage
A simple example of how to use gestalt:
We provide three examples:
A. PANDAS - X and y are both pandas DataFrames
1. Use custom wrapper for XGB to use any paras we choose, use custom R wrapper for ranger used with pandas,
use a random forest from scikit-learn
2. Create a set ... |
d13134fa7cbb9569296ef798cc9af141c0bfb132 | mgracioli/conexaoMySQLPython | /conexaoMySQL.py | 2,612 | 3.875 | 4 | #Faz a conexão com o MySQL
import mysql.connector #ao utilizar pela primeira vez: para importar tem q instalar a biblioteca C:\Users\miche\AppData\Local\Programs\Python\Python38-32\Scripts>pip install mysql-connector-python
class Conexao(object):
def conectar(self):
try:
self._conexao = mysql... |
c6453dc21a3783d471a24360a8f96b9f64c89e6e | Edinburgh-Genome-Foundry/DnaFeaturesViewer | /dna_features_viewer/compute_features_levels.py | 2,402 | 4.28125 | 4 | """Implements the method used for deciding which feature goes to which level
when plotting."""
import itertools
import math
class Graph:
"""Minimal implementation of non-directional graphs.
Parameters
----------
nodes
A list of objects. They must be hashable.
edges
A list of the fo... |
e9f6b7e2efb0b46012e251b51b9a803cd40ad39a | dolphinsboy/practice-python | /merge_sort/main.py | 168 | 3.609375 | 4 | #!/usr/bin/env python
from merge_sort import MergeSort
def main():
numbers = [3,4,1,2,10,9,8]
m = MergeSort(numbers)
m.sort()
print numbers
main()
|
b94c26e00b45e18a85dec2aa2cbffbffdaec3e32 | HoTuHi/test | /FoodBooking/src/ultil/resController.py | 1,308 | 3.5 | 4 | # add restaurant
def addRestaurant(conn, resName, email, phoneNum, imgId, posID):
sql = """
INSERT INTO Restaurants(resName,email,phoneNum,imgId,posID)
VALUES (?,?,?,?,?)
"""
try:
conn.execute(sql, (resName, email, phoneNum, imgId, posID))
conn.commit()
return "Succes... |
fc18be3ff6f638c353f8ed6511d38bcc6ff3d32f | mickeyshaughnessy/MDDFT | /Database/rmsd.py | 4,442 | 3.515625 | 4 | #!/usr/bin/env python
"""
computes RMS-D distance
"""
import numpy as np
import math
###################################################################
class rmsd:
def __init__(self) :
pass
###################################################################
def tag(self):
return "rmsd"
#################... |
8ec21541004deced1311b2f81d017b16ab476d6f | jordan336/battleship | /src/Util.py | 3,044 | 4.0625 | 4 | from Position import Position
from Ship import Ship
import random
"""
randomPlaceShips()
Given a game board and list of ships, place the ships on the game board randomly and assign each ship with corresponding positions and orientations.
"""
def randomPlaceShips(board, ships):
placedShips = []
for ship in sh... |
26be85957e8f376c3c24c368451c3b5676a75faa | sanketsoni/practice | /practice/even_first_array.py | 685 | 4.46875 | 4 | """ Reorder array entries so that even entries appear first
Do this without allocating additional storage
example-
a = 3 2 4 5 3 1 6 7 4 5 8 9 0
output = [0, 2, 4, 8, 4, 6, 7, 1, 5, 3, 9, 5, 3]
time complexity is O(n), Space complexity is O(1)
"""
def even_first_array(a):
next_even, n... |
5e60cc34478ce271947fdf1cc3f51c2d1ced8894 | Banehowl/MayDailyCode2021 | /DailyCode05022021.py | 790 | 3.578125 | 4 | # ---------------------------------------
# # Daily Code 05/05/2021
# "Roll a dXX" Lesson from edabit.com
# Coded by: Banehowl
# ---------------------------------------
# Create code that rolls a d20, d4, d6, d8, d10, d12, d00
import random
dice_20 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ... |
051b0b3ebe4ea19df81c5c1d418e9d994fc0a4a2 | Banehowl/MayDailyCode2021 | /DailyCode05062021.py | 870 | 4.0625 | 4 | # ------------------------------------------------
# # Daily Code 05/05/2021
# "Stuttering Function" Lesson from edabit.com
# Coded by: Banehowl
# ------------------------------------------------
# Write a function that stutters a word as if someone is struggling to read it. The first two letters are repeate... |
778862869cc7e90380b8953d186d59de6b49c950 | Banehowl/MayDailyCode2021 | /DailyCode05102021.py | 950 | 4.3125 | 4 | # ------------------------------------------------
# # Daily Code 05/10/2021
# "Basic Calculator (again)" Lesson from edabit.com
# Coded by: Banehowl
# ------------------------------------------------
# Create a function that takes two numbers and a mathematical operator + - / * and will perform a
# calcula... |
0d4ba8cd53a94413613181702c14d41bfe0c11d8 | Banehowl/MayDailyCode2021 | /DailyCode05252021.py | 531 | 4.0625 | 4 | # --------------------------------------------------------------------
# # Daily Code 05/25/2021
# "Return the Sum of Two Numbers (one line)" Lesson from edabit.com
# Coded by: Banehowl
# --------------------------------------------------------------------
# Create a function that takes two numbers as argume... |
932f6dcc13d9a0b0fe218295b74639621cc5a31a | nmacinnis/euler | /python/euler019.py | 235 | 3.875 | 4 | import calendar
cal = calendar.Calendar(0)
count = 0
for year in range(1901, 2001):
for month in range(1, 13):
month = cal.monthdays2calendar(year, month)
if (1, 6) in month[0]:
count += 1
print count
|
002844c6cd6654d9cc5a3af0a91e7948b258e0f4 | BerilBBJ/scraperwiki-scraper-vault | /Users/S/Sabo/the-highest-paid-civil-servants.py | 2,506 | 3.609375 | 4 | import scraperwiki
from BeautifulSoup import BeautifulSoup
def scrape_table(soup):
scraperwiki.metadata.save('data_columns', ['Name','Job Title','Organisation','Annual pay rate - including taxable benefits and allowances'])
#Identifying the tables in HTML code:
table = soup.find("table", {"clas... |
d86b818448ed9b21671db1fa6177da4020bfc6d6 | BerilBBJ/scraperwiki-scraper-vault | /Users/C/CodeBeard/us_hospitals.py | 1,636 | 3.5625 | 4 | import scraperwiki
import lxml.html
#Required Nodes look like this
#<li><a>name</a><a>city/town</a><a>county</a>state</li>
#or with a sub UL. Want all LI items that conform to structure.
#<li><a>name</a><a>city/town</a><a>county</a>state<ul><li><a>name</a><a>city/town</a><a>county</a>state</li>...</ul></li>
url = "ht... |
1304ced12d242ce48105e8dfc728422de07fd002 | BerilBBJ/scraperwiki-scraper-vault | /Users/R/robintw/uk-snow-depths.py | 3,752 | 3.71875 | 4 | ###############################################################################
# START HERE: Tutorial 2: Basic scraping and saving to the data store.
# Follow the actions listed in BLOCK CAPITALS below.
###############################################################################
import scraperwiki
html = scraperwi... |
3ac8baedd9a5876444ef6f069fa2227d8551cee4 | BerilBBJ/scraperwiki-scraper-vault | /Users/C/christophrottler/view1_2.py | 426 | 3.5 | 4 | # Blank Python
sourcescraper = ''
import scraperwiki
scraperwiki.sqlite.attach("easyscrapper1")
data = scraperwiki.sqlite.select(
'''* from easyscrapper1.swdata '''
)
for d in data:
print d["h3"], "<br>"# Blank Python
sourcescraper = ''
import scraperwiki
scraperwiki.sqlite.attach("easyscrapper1")
data = scr... |
4722d59ba9c2cf0c22d0feafc2fa84889d2d6424 | BerilBBJ/scraperwiki-scraper-vault | /Users/R/ross/near_my_town.py | 2,884 | 3.875 | 4 | import scraperwiki
# Attach to my list of UK towns, along with their lat/lng
scraperwiki.sqlite.attach("uktowns")
# Find my nearest town, for me this is Chester
my_town = scraperwiki.sqlite.select("* from uktowns.towns where town='Chester'")
lat,lng = my_town[0]['lat'], my_town[0]['lng']
# distance(%s,%s,cast(lat a... |
bfce45a508b729bc30689c19454662a0ce1a822e | BerilBBJ/scraperwiki-scraper-vault | /Users/A/amritbhandari/brit_award-1.py | 2,316 | 3.828125 | 4 | # Blank Python
import scraperwiki
from BeautifulSoup import BeautifulSoup
def scrape_table(soup):
#each column is defined here:
scraperwiki.metadata.save('data_columns', ['Year','Category','Winner'])
#table is recognised from the website:
table = soup.find("table", {"class": "in-article sortable"})
... |
54d9fde9a06d45f3e2068b7fe092bfe269c9141a | BerilBBJ/scraperwiki-scraper-vault | /Users/1/1019987/sortedlist.py | 538 | 4 | 4 |
import turtle
nos=[
'25',
'1',
'5',
'4',
]
print "Before Sorting List"
print nos
print
def numbers (x,y):
import re
def num(str):
return float(re.findall(r'\d+',str)[0])
return cmp(num(x),num(y))
nos.sort(numbers)
print "After Sorting"
print nos
import turtle
nos=[
'25',
'1',
'5',
'4',
]
print ... |
60a4792e26a09c45bc976511ed1d97b91ff14565 | BerilBBJ/scraperwiki-scraper-vault | /Users/J/Julian_Todd/julians-demo-area.py | 1,235 | 3.578125 | 4 | import re
line = "*fix 7 7 7 ; some comment"
m = re.match("(.*);(.*)", line)
print m.groups()
import re
line = "*fix 7 7 7 ; some comment"
m = re.match("(.*);(.*)", line)
print m.groups()
import re
line = "*fix 7 7 7 ; some comment"
m = re.match("(.*);(.*)", line)
print m.groups()
import re
line = "*fix 7 7 7 ; some... |
061116614ff8ba0c932e27f232d02b51be4bf1fa | BerilBBJ/scraperwiki-scraper-vault | /Users/J/jonathandeamer/emperors_new_clothes_movies.py | 1,752 | 3.65625 | 4 | sourcescraper = 'rotten_tomatoes_movies'
import scraperwiki
scraperwiki.sqlite.attach(sourcescraper)
data = scraperwiki.sqlite.select(
'''* from rotten_tomatoes_movies.swdata
where critics_score - audience_score >= 20
and critics_score >= 85
and audience_score > 0
order by c... |
ff98896908e51bd51394116b9acb91d004e29278 | BerilBBJ/scraperwiki-scraper-vault | /Users/S/shrikant/topcities.py | 13,276 | 3.609375 | 4 | # Blank Python
import scraperwiki
import urlparse
import lxml.html
# scrape_cities function: gets passed an individual MENU page to scrape
def scrape_menus(root, record, cities, restaurants):
try:
restaurants = {}
menu = {}
only_dishes = []
if root is not None:
rest_na... |
6c96e61468c8edd84fb0302307671dedbc4984e8 | BerilBBJ/scraperwiki-scraper-vault | /Users/D/DragonDave/mechanize-demo_1.py | 764 | 3.6875 | 4 | import scraperwiki
# Blank Python
import mechanize
br = mechanize.Browser()
br.open("http://everything2.org/")
for i in br.forms(): # show what forms are available in the website
print i
br.select_form('loginform')
br['user']='scraperwiki'
br['passwd']='password'
response = br.submit() # get the html of the pa... |
9eb3d654463c8e79ae1292e1a4955b8722bd9654 | BerilBBJ/scraperwiki-scraper-vault | /Users/S/SteveEdiger/ft4tch.py | 3,084 | 3.515625 | 4 | from bs4 import BeautifulSoup
import urllib2
'''
This section browses the entire site archvies processing each day at a time.
currently, it's hard-coded to a specific single day that is somewhat typical.
TO DO
Add a range of dates and wrap it around the rest of the code.
Also, set up check for last date captured ... |
703dbd35a066f23eb3609c1bac243a877bca07f3 | BerilBBJ/scraperwiki-scraper-vault | /Users/D/dmartens/sw_demo_scraper.py | 1,876 | 3.8125 | 4 | print "Hello, coding in the cloud!" # prints to the console
# Import needed libraries
import scraperwiki
import lxml.html # SW says that lxml is the best library for parsing HTML
# Identify webpage
html = scraperwiki.scrape("http://web.archive.org/web/20110514112442/http://unstats.un.org/unsd/demographic/products/soc... |
a684a269125c9ce5a23f17212a92968a6f3057b1 | BerilBBJ/scraperwiki-scraper-vault | /Users/M/meghanhoyer/wittman_bio_scrape.py | 2,324 | 3.53125 | 4 | """
Welcome to a reasonable interpretation of a scraper in scraperwiki.
This is mostly Pythonic, which is always good.
Today, we'll be scraping a member of congress's Web site for the
Great American Scraper (GASP) project from Sunlight Foundation.
"""
# Imports!
import lxml.html
import scraperwiki
# Initialize the s... |
cb54ded250bd61dbe06dce206e4f7200a6fbe530 | BerilBBJ/scraperwiki-scraper-vault | /Users/M/mpfeil/lanuv_stations_information.py | 664 | 3.5 | 4 | import scraperwiki
import lxml.html
#from BeautifulSoup import BeautifulSoup
html = scraperwiki.scrape("http://www.lanuv.nrw.de/luft/temes/stat.htm")
root = lxml.html.fromstring(html)
table = root.cssselect("div#daten table tbody")
for el in table:
print el.tag
for el2 in el:
print "--", el2.tag, el2... |
c4809f0af2527ca1d798f6081b8f349e613f509a | BerilBBJ/scraperwiki-scraper-vault | /Users/T/tecoholic/tamilbeat2.py | 6,414 | 3.515625 | 4 | ###############################################
# Scrapper to get album information
###############################################
import re
import scraperwiki
import sys
#from scraperwiki.apiwrapper import getKeys, getData
from BeautifulSoup import BeautifulSoup
def makeSoup(url):
''' This function creates a... |
485da0591c5f8cc5193211bbfb8f66bf837db539 | BerilBBJ/scraperwiki-scraper-vault | /Users/J/Julian_Todd/2010-statutory-instruments-ireland-copy.py | 17,173 | 3.71875 | 4 | """
This is an example of scraping multiple URLs.
"""
import scraperwiki
import re
import BeautifulSoup
from datetime import datetime
from scraperwiki import datastore
# get the index of all from 2010
urlindex = "http://www.irishstatutebook.ie/2010/statutory.html"
htmlindex = scraperwiki.scrape(urlindex)
print html... |
74983b6aa174063b72b426bbb628fec4047c5a5f | BerilBBJ/scraperwiki-scraper-vault | /Users/0/0913081/shahab-uddin-0913081.py | 2,288 | 3.8125 | 4 | import scraperwiki
from BeautifulSoup import BeautifulSoup
def scrape_table(soup):
#To distinguish each column by Names:
scraperwiki.metadata.save('data_columns',['Team','Location','Stadium','Stadium capacity'])
#Identifying the tables in HTML code:
table = soup.find("table", {"class": "wikitable sort... |
5eab2372d16ef6580873e27e1bc91153a597eb37 | BerilBBJ/scraperwiki-scraper-vault | /Users/J/Julian_Todd/tutorial-lxml-html.py | 20,727 | 3.765625 | 4 | # lxml is a complete library for parsing xml and html files. http://codespeak.net/lxml/
# The interface is not totally intuitive, but it is very effective to use,
# especially with cssselect.
import lxml.etree
import lxml.html
#print help(lxml.html.parse)
# create an example case
samplehtml = """<html><body>
<h1>... |
8d1748d08249afbb2c255a06e7e4fae2763bcbd1 | BerilBBJ/scraperwiki-scraper-vault | /Users/J/jprichter/view-tutorial.py | 642 | 3.609375 | 4 | #sourcescraper = ''
import scraperwiki as sw
sw.sqlite.attach('school_life_expectancy_in_years')
data = sw.sqlite.select('''* from school_life_expectancy_in_years.swdata order by years_in_school desc limit 10''')
print data
print '<table>'
print '<tr><th>Country</th><th>Years in School</th>'
for d in data:
print... |
b901ea6037c433770a296daf20a7a0e8839118ce | BerilBBJ/scraperwiki-scraper-vault | /Users/M/me2space/test_197.py | 992 | 3.5 | 4 | # More airports available, http://www.weather.gov/xml/current_obs/
import requests
import lxml
from lxml import html
# To grab the URL and convert into an lxml object ...
r = requests.get('http://www.weather.gov/data/obhistory/KMCO.html')
root = lxml.html.fromstring(r.content)
for tr in root.cssselect("td[align='left... |
65789efb80588cf6b49948a5b6e973ab4c773b59 | BerilBBJ/scraperwiki-scraper-vault | /Users/J/jeremyjbowers/dc_recent_crime_incidents.py | 8,562 | 3.546875 | 4 | """
Welcome to my DC crime scraper.
ScraperWiki doesn't like all of the data, so
I've left in 2012 as the small (90-ish records)
to demonstrate what you can get out of it.
Set the years at the top, either one year,
e.g., [2012] or a range of years, e.g.,
range(2007,2011).
"""
import scraperwiki
import requests
impo... |
589291a637783bd47940ae796cf8bcb72613eaa6 | BerilBBJ/scraperwiki-scraper-vault | /Users/P/peterverweij/eu.py | 4,008 | 3.65625 | 4 | import scraperwiki
import urllib2
#f = open("currencies", "w")
page = urllib2.urlopen("http://www.ecb.eu/stats/exchange/eurofxref/html/index.en.html")
from BeautifulSoup import BeautifulSoup
#dit is de hele pagina in de html soup
soup = BeautifulSoup(page)
#zoeken in html soup
rate = soup.findAll(attrs={"class":"rate... |
560e22466b3bea8571bf88ab2e2f782535f72a3f | BerilBBJ/scraperwiki-scraper-vault | /Users/M/mirjamle/scrapeddata.py | 6,072 | 3.609375 | 4 | import scraperwiki
from bs4 import BeautifulSoup # documentation at http://www.crummy.com/software/BeautifulSoup/bs4/doc/
#attach your previous scraper which collected the source code of the individual pages (use the name shown in the scraperwiki URL!)
scraperwiki.sqlite.attach("pageextract")
#select the database that... |
326f08d5bfaa341491f155fa016cd8b9cd2202b8 | BerilBBJ/scraperwiki-scraper-vault | /Users/C/crandle7/c.py | 2,884 | 4 | 4 | """
This is an example of scraping multiple URLs.
"""
import scraperwiki
import scraperwiki
import BeautifulSoup
import re
# The URLs we're going to scrape:
urls = """
http://www.guildofmasterchimneysweeps.co.uk
http://www.yell.com/
http://www.findacraftsman.com/
http://www.findacraftsman.com/
http://www.guildprop... |
8d2d5b8def82492bee66643adee6854380f5cd58 | BerilBBJ/scraperwiki-scraper-vault | /Users/I/ianmac/sf_volunteer_oportunities.py | 1,326 | 3.546875 | 4 | import scraperwiki
from BeautifulSoup import BeautifulSoup
def get_soup(url):
html = scraperwiki.scrape(url)
return BeautifulSoup(html)
# fields are currently:
# category
# position
# description
# location
soup = get_soup('http://www6.sfgov.org/index.aspx?page=42')
alinks = soup.find('div', {'id': '_ctl0_co... |
1bd6079d79a145a42aeecdf531e85a72ab358b52 | BerilBBJ/scraperwiki-scraper-vault | /Users/F/falastefano/documentation_first_view_tutorial.py | 2,192 | 3.8125 | 4 | import scraperwiki
#
# Documentation / First view tutorial
#
# Test Python
#print "This is a <em>fragment</em> of HTML."
# 1. Query the scraper's datastore
# --------------------------------
# Before you can read the scraper's datastore from the view, you need to attach to it, using its shortname (the name in its ... |
521ab5c64cd076e770e47eadcccf91541c429d5b | BerilBBJ/scraperwiki-scraper-vault | /Users/C/cityoflincolncouncil/city-of-lincoln-council-latest-news-scrape.py | 4,374 | 3.515625 | 4 | ###############################################################################
# Scraper designed to interrogate the Latest News page of CoLC website
# and pull all information back into the Scraperwiki datastore for
# future reference
###############################################################################
#... |
4a67fbf3863e94f5e756702b902545bb93f8576d | BerilBBJ/scraperwiki-scraper-vault | /Users/M/miks/testing_39.py | 4,608 | 3.59375 | 4 | import scraperwiki
import sys, httplib2, urllib, re, random
from lxml import etree
import lxml.html
from StringIO import StringIO
from time import sleep
def chunks(l, n):
'''
http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python
'''
return [l[i:i+n] for ... |
9d9f0ec04a038f62e251d2e2c354b7df250f68e6 | BerilBBJ/scraperwiki-scraper-vault | /Users/T/tlevine/usps_lookup.py | 10,927 | 3.5 | 4 | '''
Send a query string
'''
import os
from urllib2 import urlopen, URLError
from urllib import urlencode
from urlparse import parse_qs
from lxml.html import fromstring
from json import dumps
ADDRESS_LOOKUP_URL = 'https://tools.usps.com/go/ZipLookupResultsAction!input.action?'
EXPECTED_KEYS = {'address1', 'address2',... |
208b679b886c3289b148ed31eedb06dbbda880fb | BerilBBJ/scraperwiki-scraper-vault | /Users/1/1019527/phn-hacking.py | 3,132 | 3.875 | 4 | import scraperwiki
html = scraperwiki.scrape('http://scraperwiki.com/hello_world.html')
print html
from BeautifulSoup import BeautifulSoup
soup = BeautifulSoup(html) # turn our HTML into a BeautifulSoup object
def scrape_table(soup):
#To define the name of the columns
scraperwiki.metadata.save('data_columns'... |
85440921d02c990a8403eaa2038abbeed5ef05b6 | BerilBBJ/scraperwiki-scraper-vault | /Users/A/amandabee/nymag_salaries.py | 914 | 3.5625 | 4 | import scraperwiki
from bs4 import BeautifulSoup
import string
import urllib2
import urlparse
import re
html = scraperwiki.scrape("http://nymag.com/guides/salary/14497/index1.html")
soup = BeautifulSoup(html)
story = soup.find("div", id="story");
#for paragraph in story.find_all("p"):
# print paragraph.content... |
2557b513ad8d1c6d4532f514129335b28d4036d1 | BerilBBJ/scraperwiki-scraper-vault | /Users/K/Kujore/first-2.py | 2,816 | 3.59375 | 4 | import scraperwiki
html = scraperwiki.scrape("http://www.guardian.co.uk/news/datablog/2011/jan/24/worldwide-cancer-rates-uk-rate-drops")
print html
import BeautifulSoup
soup = BeautifulSoup.BeautifulSoup(html)
for td in soup.findAll('td'):
print td.string
for td in soup.findAll('td'):
scraperwiki.d... |
4acdbfb1c43e63756b53dbee4a571da82398c5fe | BerilBBJ/scraperwiki-scraper-vault | /Users/E/Emil/wired_scraper.py | 6,574 | 3.53125 | 4 | # A scraper to collect words with the selected keyword (find)
#not working atm.
import scraperwiki
import requests
import lxml.html
def scrape_wired(keyword):
for i in range(2007, 2012):
for j in range(1, 12):
r = requests.get('http://www.wired.com/business/%s/%s/' % (i,j))
if r.... |
2c77342d8513139d6c2a4abb469dc5af25ff3908 | BerilBBJ/scraperwiki-scraper-vault | /Users/R/ricky13/hoja1to5.py | 9,800 | 3.703125 | 4 | import scraperwiki
import re
import urllib2
from urllib import urlopen
from BeautifulSoup import BeautifulSoup
from BeautifulSoup import BeautifulStoneSoup
scraperwiki.sqlite.execute("CREATE TABLE firstsetd ('Full name' string,'Degree' string,'Title' string, 'Department' string, 'Speciality' str... |
8caa76721e8220da04fded48ddf86cba6858b4dc | BerilBBJ/scraperwiki-scraper-vault | /Users/O/onlyandrewn/undefined_4.py | 388 | 3.6875 | 4 | import scraperwiki
import re
# Blank Python
full_name = "Glen Edward McGregor"
middle_name = re.search("Glen(.+?)McGregor", full_name)
print middle_name
middle_name = middle_name.group(1)
print middle_name
import scraperwiki
import re
# Blank Python
full_name = "Glen Edward McGregor"
middle_name = re.search("Glen(.... |
ba2dd8ff6b745d307a30b14d4def38384e4de64c | BerilBBJ/scraperwiki-scraper-vault | /Users/T/taekim630/weather_forecast_2.py | 2,816 | 3.65625 | 4 | #Kevin Kim
#self; no group
#5.6.13
#Scraper Wiki Script in-class exercise
import scraperwiki
#This scraper pulls weather information including highest and lowest temperatures in each date.
import lxml.html
#This part assigns specific web site that we are going to pull out information to scrape
html = scra... |
385ca019ea9dea1c027ea1dedcf3e008a5685aba | BerilBBJ/scraperwiki-scraper-vault | /Users/A/adrian/scraper19.py | 5,482 | 3.828125 | 4 | import scraperwiki
#import the libraries containing our functions
import scraperwiki
import lxml.html
import urllib
# scrape_table function: gets passed an individual page to scrape
def scrape_table(root):
rows = root.cssselect("tr") # selects all <tr> blocks
for row in rows:
# Blank Python
# Set up our data r... |
d1e61a030d11011788d15557fcfa6292c666b80b | BerilBBJ/scraperwiki-scraper-vault | /Users/G/gothictec/actor-search.py | 30,048 | 3.5625 | 4 | ###
#
# 0916162 (Luke Mills)
# University of Wolverhampton
#
# Scraper WIKI assignment
# CP4010 Programming for Application Development - Sarah Mount
#
# Application Purpose:
#
#
###
###
# IMPORTS
###
import scraperwiki
from BeautifulSoup import BeautifulSoup
import re
# define the order our columns are displa... |
0ad7756bbd4a8c857562c6e5384c71212b846cf4 | BerilBBJ/scraperwiki-scraper-vault | /Users/C/carlplant/mccance_and_widdowsons_the_composition_of_foods_in.py | 4,648 | 3.859375 | 4 | #This is the first pass at a scraper of Excel files.
#Currently it scrapes the first sheet of one spreadsheet, identified by URL
#NEED TO ADD:
#All sheets - keys grabbed from header row
#More than one spreadsheet, linked from one URL
#useful guides at:
#https://scraperwiki.com/docs/python/python_excel_guide/
#http:/... |
d0af08960b3ab25990215de559c1df921d925948 | BerilBBJ/scraperwiki-scraper-vault | /Users/T/tagint/scrape_html_try.py | 5,358 | 3.53125 | 4 | import scraperwiki
# testing
# Blank Python
import lxml.html
#parse url
scraperwiki.sqlite.execute("drop table if exists swdata")
years = ['2009','2010','2011','2012']
months = ['january', 'february', 'march', 'april', 'may', 'june', 'july',
'august', 'september', 'october', 'november', 'december']
rec... |
a9333068c276780ba640494bf4cc297bb3565c2d | BerilBBJ/scraperwiki-scraper-vault | /Users/A/AnnaPS/draft_weather.py | 4,758 | 3.734375 | 4 | ###############################################################################
# Simple BBC weather scraper - demonstrates basic use of BeautifulSoup,
# setting up records, and saving records to the data store
###############################################################################
import scraperwiki
from Beau... |
9efb392aef67bc9de90dd75be4f3ba8077abde06 | BerilBBJ/scraperwiki-scraper-vault | /Users/D/DragonDave/imdb_in_progress.py | 2,898 | 3.578125 | 4 | # Blank Python
url='http://www.imdb.com/name/nm1476707/' # dizzee rascal
import scraperwiki, re
import BeautifulSoup
# http://stackoverflow.com/questions/4995116/only-extracting-text-from-this-element-not-its-children
html = scraperwiki.scrape(url)
print html
soup = BeautifulSoup.BeautifulSoup(html)
# performances... |
6813bc43e6f6108e46498c03f1ca9342f207f8c2 | BerilBBJ/scraperwiki-scraper-vault | /Users/M/marjoleinpijnappels/evenmoretrialanderror.py | 1,432 | 3.640625 | 4 | import scraperwiki
from bs4 import BeautifulSoup
scraperwiki.sqlite.attach('moretrialanderror')
scrapings = scraperwiki.sqlite.select("* from 'moretrialanderror'.swdata")
for scraping in scrapings:
url = scraping["URL"]
#print url
soup = BeautifulSoup(scraping["HTML"])
title = soup.find("div","fiel... |
f0d4604005a3efd013875c2ec723532ff3845857 | BerilBBJ/scraperwiki-scraper-vault | /Users/S/sco/wee_red_bar.py | 3,748 | 3.5 | 4 | import scraperwiki
import itertools
import lxml.html
import urllib2
def extract_event(date_cell, title_cell):
'''
Returns and event dict containing event information as strings extracted
from the given date_cell and title_cell.
'''
def title_text(xpath_expr):
'''
Returns the te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.