学习笔记
moyl0923
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
OS模块学习
import os,shutil src_path='D:/00-test' dst_path='D:/00-test/pic' os.rmdir('D:/00-test/pic') os.mkdir('D:/00-test/pic') #读取模块 #将关键词的文件,导入列表 list=[] for file in os.listdir('D:/00-test'): i...原创 2018-08-29 11:28:22 · 197 阅读 · 0 评论 -
Python基础学习【1】
#List基础知识 1.append在列表末尾添加对象 >>>a=[1,2,3] >>>a.append(4) >>>a [1,2,3,4] 2.clear清空列表原创 2018-09-04 10:21:55 · 275 阅读 · 0 评论 -
Python基础学习【2】
字符串基础 >>>'hello,%s!' % ('mo') # 'xxx %s' % ('ss') %作为标识符 'hello,mo!' >>>'{foo}{bar}'.format(bar=4,foo=3) #按字段名ba原创 2018-09-06 18:40:54 · 146 阅读 · 0 评论 -
Python基础学习【3】
字符串方法 1.center居中字符串,根据width两侧填充 >>>'apple'.center(8) #ljust\rjust\zfill 末尾填充\首填充\用0首填充 '_apple__' #'_'代表空格 2.find查找字符串,返回索引(lfind\rfind 从首查\从尾查) >>>'apple banana orange'.find...原创 2018-09-07 12:13:35 · 165 阅读 · 0 评论 -
【小应用】批量修改txt内容
import os with open('1.txt','r') as f: #打开原文件 with open('new.txt','w') as ff: #创新新文件 for line in f.readlines(): #逐行读取 if line[0] !='-': #读取首字符不是‘-‘的行 ...原创 2018-09-21 15:58:28 · 3018 阅读 · 0 评论 -
【备忘】.find查找中文
>>>a='我是谁' >>>a.find(u'是') 1原创 2018-11-26 16:17:29 · 1135 阅读 · 0 评论 -
numpy的保存与读取
import os import numpy as np os.chdir('C:/Users/Administrator/Desktop') #更改工作目录 ar = np.random.rand(5,5) #生成5*5的0-1的数组 np.savetxt('test.txt',ar,delimiter=',',fmt='%.2f') #保存...原创 2019-01-17 14:47:54 · 212 阅读 · 0 评论
分享