This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
import shutil | |
DIR = '/home/dani/bin/dota_2_items/' | |
html = requests.get('https://dota2.gamepedia.com/Items').text | |
s = BeautifulSoup(html, 'html.parser') | |
mark = s.find('span', id="Items") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
""" | |
"option definitions" and "time definitions could also have been placed in extra files and imported. | |
""" | |
#----------------------- | |
#- Option Definitions: - | |
#----------------------- | |
options = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
print(requests.put('http://localhost:8000/test',data={'txt':'Hello World'}).json()) | |
# prints "success" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## First ########################################## | |
mystery = iter('') | |
# challenge code | |
def print_stuff(stuff): | |
if stuff: | |
print "Printing some stuff" | |
for x in stuff: | |
print x | |
else: | |
print "Nothing to print" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
import collections | |
#utility functions | |
def calc_dist(dice_list,fun): | |
cntr = {i:0 for i in range(2,13)} | |
cntr.update(collections.Counter(map(fun, dice_list))) | |
if len(cntr) != 11: # discard if sums outside of range(2,13) are generated | |
return ['== WRONG == ']*11 | |
return ['{: >3} : {: >5.2f}%'.format(k,100*v/len(dice_list)) for k,v in cntr.items()] |
NewerOlder