1.输出 print print 函数可以打印整数,浮点数,字符串 >>> print(5) // 打印整数 5 >>> print(5.1) // 打印浮点数 5.1 >>> print("hello") // 打印字符串 hello print 函数可以打印整数,浮点数,字符串 print(fo...
分类:
其他好文 时间:
2015-10-28 09:23:16
阅读次数:
145
if循环:两种选择例1:1 a=422 if a<=10:3 print('the number less than 10')4 else:5 print('thank you!')例2: while循环:重复某个功能多次例11 greetings=12 while greetings<...
分类:
编程语言 时间:
2015-10-28 01:14:37
阅读次数:
219
public static void print(object message){ Debug.Log(message);}没看错,实现就是通过Debug.Log来完成的。所以Print就是Debug.Log的一个简单封装
分类:
其他好文 时间:
2015-10-27 23:36:55
阅读次数:
471
版本:2.7.8python是解释型语言,执行一次翻译一次,选择用cpython作为解释器输出: 1 print "Hello world" 2 #等同于 "Hello world" 3 4 #一般情况下都要在文件开头确定编码格式,写法如下 5 #!/usr/bin.python 6 # _*_ ....
分类:
其他好文 时间:
2015-10-27 23:36:43
阅读次数:
203
# -*- coding: utf-8 -*-#python 27#xiaodeng#模块的创建#任何的.py文件都可以被认为是一个模块,在模块的顶层指定的所有变量名都会变成其属性,并可以导出供客户端使用#module1.pydef printer(x): print x'''import m...
分类:
其他好文 时间:
2015-10-27 23:27:15
阅读次数:
222
# -*- coding: utf-8 -*-#python 27#xiaodeng#如何通过from语句调用模块的变量名?#my.pydef printer(x): print x#如何通过from语句调用模块的变量名?#方法一:from my import printer#方法二#from...
分类:
其他好文 时间:
2015-10-27 23:19:10
阅读次数:
122
不知道上篇的例子有没有朋友去试过,试过的朋友应该很疑惑,为什么会报错?我们来编译几个文件看看头文件到底是如何导入的;a.cvoid hellow(){ printf("hellow"); }a.h#include "b.h";void hellow();b.cvoid word(){ print.....
分类:
移动开发 时间:
2015-10-27 17:32:12
阅读次数:
208
读写文件是最常见的IO操作。Python内置了读写文件的函数,用法和C是兼容的。 try:
f = open(r‘C:\Users\syc\Desktop\temp.txt‘)
print f.read()
finally:
if f:
f.close() 读取文件必须执行c...
分类:
编程语言 时间:
2015-10-27 13:43:04
阅读次数:
245
#include #include using namespace std; void print(int *arr, int start, int end) { for (int i = start; i arr[j]) { k = j; key = arr[j]; whi...
分类:
编程语言 时间:
2015-10-27 11:21:35
阅读次数:
189
【c++】必须在类初始化列表中初始化的几种情况1. 类成员为const类型2. 类成员为引用类型复制代码#include using namespace std;class A{ public: A(int &v) : i(v), p(v), j(v) {} void print_va...
分类:
编程语言 时间:
2015-10-27 00:27:31
阅读次数:
205