//: Playground - noun: a place where people can playimport UIKit// 无参无返回// -> Void可以省略不写, 或者写成(), 因为返回值为空本质是一个空的元组func run() -> Void // (){ print("...
分类:
编程语言 时间:
2015-12-17 10:28:46
阅读次数:
172
一、多线程import threadingfrom time import ctime,sleepdef music(func): for i in range(2): print("I was listening to %s. %s" %(func,ctime())) ...
分类:
编程语言 时间:
2015-12-17 06:55:39
阅读次数:
235
REPL —— Read-Eval-Print-Loop.00.一门好的编程语言的必要条件REPL并不是什么高大上的东西,简单的说就是一个从命令行程序,读取终端输入,处理,打印结果,如此循环。这是一门比较全面的编程语言的基础。刚开始接触NodeJS,以为就是一个服务端Js,但学习了一段时间之后才感受...
分类:
Web程序 时间:
2015-12-17 01:49:01
阅读次数:
327
1. 使用内建函数range print sum(range(1,101))2. 使用函数reduce print reduce(lambda a,b:a+b,range(1,101))3. 使用循环n = 0for x in range(101): n = x + n
分类:
编程语言 时间:
2015-12-17 00:35:00
阅读次数:
297
创建二维list:animals=[]
foriinrange(5):
animals.append(["O"*5])读取二维list:printanimals[0][0]listfor中使用index:choices=[‘pizza‘,‘pasta‘,‘salad‘,‘nachos‘]
print‘Yourchoicesare:‘
forindex,iteminenumerate(choices):
printindex+1,item
range有负数的用法:s..
分类:
其他好文 时间:
2015-12-16 19:43:03
阅读次数:
148
注:只能定时任务执行,不可后台执行#!/bin/bash
#byLC
USER=root
PASSWD=123456
CRONNECTEB=`mysql-u$USER-p$PASSWD-e"showstatus;"|grepThreads_connected|awk‘{print$2}‘`
LOGS=/home/lichuang/mysql_alert.log
MAIL1=lichuang@lichuaung.com
MAIL2=jingli@jingli.com
MAIL3..
分类:
数据库 时间:
2015-12-16 17:33:02
阅读次数:
352
//: Playground - noun: a place where people can playimport UIKit// 对区间进行判断var score = 90switch score {case 0: print("You got an egg!")case 1..是介绍运算...
分类:
编程语言 时间:
2015-12-16 17:11:15
阅读次数:
162
1.写返回类型2.return 返回值3.定义变量接受返回值public class App2 { public String [] print(String msg, int num) { for (int i = 0; i < num; i++) { S...
分类:
编程语言 时间:
2015-12-16 17:10:50
阅读次数:
150
clinet端#!/usr/bin/envpython
#-*-coding:utf-8-*-
#这段代码是clinet端
importsocket#forsockets
importsys#forexit
try:
#createanAF_INET,STREAMsocket(TCP)
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
exceptsocket.error,msg:
print‘Failedtocreatesocket.Er..
分类:
编程语言 时间:
2015-12-16 12:52:56
阅读次数:
159
学了写 swift ,这里简单的列出 swift 的用法//传统的 for 循环的写法for var i = 0;i<10;i++ { print(i)}//..i 的值为0~9,不包含10for i in 0..<10 { print(i)}//...i 的值为0到10for ...
分类:
编程语言 时间:
2015-12-15 14:34:21
阅读次数:
154