一.save,load >> a=[ ]; >> b=[ ] b = >> save('b.mat','a','b');%a file named b.mat will exit >> clear >> load b.mat >> %load the data a and b 二.txt文件 假设在当前目录下有个txt文件data.txt,内容如下: 1 2 34 5 67 8 9 使用语句: load data.txt,当前就会多出…
一.循环(for,while) for循环: for i=begin:step:end ...... end while循环: while condition ...... end 二.分枝(if,if-else,switch-case) if condition ...... else ...... end ======================================== switch var case value1 ... case value2 ... otherwise…
一.文件 1.控制文件内指针的移动 文件内指针移动,只有t模式下的read(n),n代表的字符的个数除此以外文件内指针的移动都是以字节为单位 with open('a.txt',mode='rt',encoding='utf-8') as f: msg=f.read(1)#t模式下的read,按照字符数来移动 print(msg) with open('a.txt',mode='rb') as f: msg=f.read(3)#t模式以外的的所有指针移动,按照字节数来移动 print(msg.d…