Skip to content

Instantly share code, notes, and snippets.

Byron imbyron

Block or report user

Report or block imbyron

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View press.one
{"sig":"622d7ee0ecfb76f037511f3d7f64bf23ae46466551ad99f9124dce8b80ce2207d04b7dd8af9c5f50d24a9fa4bc6b20580af275bfb30359e93fc6f9f37ae272ed1","msghash":"ae1e2bb7c5704d063ad39d3fe0e0411d8ba55eb40ca6c18901d29c7cafdba9dd"}
@imbyron
imbyron / filter_3.x.py
Last active Dec 31, 2015
python3中filter的用法
View filter_3.x.py
text = "aAsmr3idd4bgs7Dlsf9eAF"
#只保留数字
list(filter(str.isdigit, text))
#只保留字母
list(filter(str.isalpha, text))
def f(x):return x%2 != 0 and x%3 != 0
list(filter(f,range(1,50)))
#结果:[1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47, 49]
@imbyron
imbyron / m_n.py
Last active Dec 31, 2015
本程序会从1~n中随机取m个数,其中1<=m<=n
View m_n.py
#!/usr/bin/python
#coding:utf-8
#author:byron
#blog:http://jiabin.tk
import random
def m_n():
print("本程序会从1~n中随机取m个数,1<=m<=n")
n = int(input("输入n的值:"))
m = int(input("输入m的值:"))
@imbyron
imbyron / qiubai.py
Last active Dec 22, 2015
糗百命令行版,最近学习正则表达式,抛弃了bs4,写了这么一个小爬虫,爬了糗百最近7天最热门的糗事儿。
View qiubai.py
#!/usr/bin/python
#coding:utf-8
#作者:Byron
#博客:http://jiabin.tk
import urllib2
import re
#定义程序主函数
def qiubai(page):
@imbyron
imbyron / hot_movies.py
Last active Dec 22, 2015
用Python的BeautifulSoup模块抓取豆瓣热映电影
View hot_movies.py
#!usr/bin/python
#coding:utf-8
'''
@author:Byron
新浪围脖:http://weibo.com/ziyuetk
'''
import urllib2
from bs4 import BeautifulSoup
print "豆瓣正在热映:"
url = "http://movie.douban.com"
@imbyron
imbyron / city.py
Created Jul 24, 2013
全国城市代码列表 for weather.com.cn
View city.py
# -*- coding: utf-8 -*-
city = {
'北京': '101010100',
'海淀': '101010200',
'朝阳': '101010300',
'顺义': '101010400',
'怀柔': '101010500',
'通州': '101010600',
'昌平': '101010700',
'延庆': '101010800',
@imbyron
imbyron / weather.py
Last active Aug 23, 2017
拙作:利用国家气象局的API查询天气的工具。
View weather.py
#!/usr/bin/python
#coding:utf-8
'''
@author:Byron
新浪微博:http://weibo.com/ziyuetk
'''
import urllib2, json
from city import city
yourcity = raw_input("你想查那个城市的天气?")
View Python_append.py
def foo(numbers=None):
if numbers is None:
numbers = []
numbers.append(9)
print numbers
View def_bingo.py
def isEqual(num1,num2):
if num1 < num2:
print '%d is too small.' %num1
return False
if num1 > num2:
print '%d is too big.' %num1
return False
if num1 == num2:
print 'BINGO,you win!!!'
return True
View bingo.py
from random import randint
num = randint(1,1000)
print 'Guess what i think?'
bingo = False
while bingo == False:
answer = input()
if answer < num:
print '%d is too small.' % answer
if answer > num:
You can’t perform that action at this time.