This file contains 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
# coding=gbk | |
import time | |
from datetime import datetime | |
LAST_MINUTE = 59 #when it is the last mintue in an hour,the minute is (60-1) | |
MINUTE_SECONDS = 60#one minute has 60s | |
def main(): | |
'''This is a main function to print bell when time is the whole point.''' | |
This file contains 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
# coding=utf-8 | |
import time | |
from datetime import datetime | |
from douban_client import DoubanClient | |
LAST_MINUTE = 59 # when it is the last mintue in an hour,the minute is (60-1) | |
MINUTE_SECONDS = 60 # one minute has 60s | |
API_KEY = 'your api key' | |
API_SECRET = 'your api secret' | |
SCOPE = 'douban_basic_common,shuo_basic_r,shuo_basic_w' |
This file contains 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
# -*- conding:utf-8 -*- | |
import math | |
import calendar | |
#1.a) | |
math.abs(-4.3) | |
#1.b)进一法是嘛?ceil? | |
math.ceil(math.sin(34.5)) | |
#2.a) |
This file contains 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
Python补充01 序列的方法 | |
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明。谢谢! | |
在快速教程中,我们了解了最基本的序列(sequence)。回忆一下,序列包含有定值表(tuple)和表(list)。 | |
此外,字符串(string)是一种特殊的定值表。表的元素可以更改,定值表一旦建立,其元素不可更改。 | |
This file contains 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
Python内置函数清单 | |
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明。 | |
Python内置(built-in)函数随着python解释器的运行而创建。在Python的程序中,你可以随时调用这些函数,不需要定义。 | |
最常见的内置函数是: | |
print("Hello World!") |
This file contains 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
# -*- coding:utf-8 -*- | |
import smtplib | |
username = "*******@163.com" | |
password = "*********" | |
smtp = smtplib.SMTP() #继承SMTP()的属性 | |
smtp.connect("smtp.163.com","25") #连接服务器和端口 | |
mail_text = """ | |
From: *******@163.com\r\n |
This file contains 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
# Rock-paper-scissors-lizard-Spock template | |
import random | |
# The key idea of this program is to equate the strings | |
# "rock", "paper", "scissors", "lizard", "Spock" to numbers | |
# as follows: | |
# | |
# 0 - rock | |
# 1 - Spock | |
# 2 - paper |
This file contains 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
# -*- coding=utf-8 -*- | |
def is_int(): | |
inputNum = int(input("Please input a number: ")) | |
#生成补偿值的列表 | |
offset_list = range(1,6) | |
#生成 inputNum-补偿值 列表 | |
new_list = [(inputNum - 2**i)%32 for i in offset_list] | |
#判断 inputNum-补偿值是不是32的倍数 | |
if new_list.count(0) == 1: |
This file contains 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
# template for "Guess the number" mini-project | |
# input will come from buttons and an input field | |
# all output for the game will be printed in the console | |
import simplegui | |
import random | |
import math | |
# initialize global variables used in your code | |
num_range = 0 | |
num_guess = 0 |
This file contains 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
# -*-coding:utf-8 -*- | |
import os | |
path = r"C:\Users\alex\Desktop\debug" | |
original_file = open(r"module.txt", "r") # read file | |
content = original_file.readlines() | |
def lib_list_without_so(yourdir): | |
""" Create a list which contains all the libs without '.so' |
OlderNewer