这是一种PHP没有的结构,类似于数组// // main.m // say_hellow // // Created by 刘立博 on 14-4-15. // Copyright (c) 2014年 刘立博. All rights reserved. // #import <Foundation/Foundation.h> typedef enum{
点击 product->scheme->edit schme然后在arguments中添加 需要的启动参数
argc,argv 用命令行编译程序时有用。主函数main中变量(int argc,char *argv[ ])的含义有些编译器允许将main()的返回类型声明为void,这已不再是合法的C++main(int argc, char *argv[ ], char **env)才是UNIX和Linux中的标准写法。argc: 整数,用来统计你运行程序时送给main函数的命令行参数的个数* argv[
while (fgets(word, 100, filedata)) { word[strlen(word)-1] = ''; NSLog(@"%s lens is %lu",word,strlen(word)); }发现例子里面有这么一句word[strlen(word)-1] = '';是字符串的结束符,但为什么要把最后一位换成结束
// // main.m // say_hellow // // Created by 刘立博 on 14-4-15. // Copyright (c) 2014年 刘立博. All rights reserved. // #import <Foundation/Foundation.h> BOOL test_one (int thing1, int thing
进行读写文件的函数是open或file获取文件句柄open(filename, mode)file(finename, mode)r只读r+读写w 写入 先删除源文件w+读写 先删除源文件a 追加写a+追加读写b打开二进制文件U支持所有换行符读取文件内的数据obj.read()obj.read()写入write('string')关闭obj.close()obj.close()#!
Python对内存的使用浅拷贝和深拷贝变量是没有类型之分的,类型取决与赋给他的值所谓的浅拷贝就是为对象建立一个新的地址空间,但数据还是指向同样的地址空间深拷贝就是把对象和数据都拷贝到一个不同的地址空间浅拷贝import copyc = copy.copy(a)只是拷贝了父对象,但数据的地址是不变的深拷贝copy.deepcopy()#!/usr/bin/python #coding:utf8
findall函数会返回与正则匹配但是不重叠的字符finditer函数会返回一个迭代器,它将生成match实例#!/usr/bin/python #coding:utf8 import re text = 'mio is mio say mio mio!' pattern = r'mio' for match in re.findall(pattern, text): prin
search函数取模式和要扫描的文本作为输入,如果找到会返回一个match对象,如果没有找到则会返回None编译表达式会更为高效,complie()函数会把一个表达式字符串转换为一个regexObject模块级函数会维护已编译表达式的缓存,不过这个缓存的大小是有限制的,直接使用已编译的表达式可以避免缓存查找开销,通过在加载模块是预编译表达式,可以把编译工作转到程序开始,而不是在响应的时候即时编译#
#!/usr/bin/python #coding:utf8 import textwrap str=""" Return a list of the words in the string, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done (thus, th