![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
yven_style
一个人有两块手表就永远不知道时间
展开
-
python设置编码格式utf-8
# -*- coding: utf-8 -*-原创 2017-09-13 16:03:12 · 3381 阅读 · 0 评论 -
Python打印list中的所有元素(list嵌套)
#!/usr/bin/python# _*_ coding: UTF-8 _*_t=[1,2,3,[3,4,5,[5,4,3],5],1,2,[4,5],7,4,[6,34]]def func(L): for i in L: if(isinstance(i,list)): func(i)原创 2017-09-22 16:22:54 · 11388 阅读 · 1 评论 -
Linux下Python加载自定义模块
在IDE中运行>>> import sys>>> sys.path.append("/home/yven/pythonTES")//加载路径>>> import module1 //加载模块>>> from module1 import func,sysHello //加载模块中的函数>>> sysHello("ggg") //使用函数hell0:ggg>>> func(原创 2017-10-10 17:35:44 · 3054 阅读 · 0 评论 -
Python知识点1
1、strip()方法可从字符串去除空白符2、print()的file参数控制将数据发送/保存到哪里3、finally总会执行,不论try/except语句出现什么异常4、str()可以用来访问任何数据对象的串表示5、locals()返回当前作用域中的变量集合6、in 操作符用于检查成员关系7、with 语句会自动处理所有已打开文件的关闭工作,即使出原创 2017-10-12 08:39:21 · 152 阅读 · 0 评论 -
Python文件读写
import pickle...man=[]other=[]with open('man.out','wb') as manOut , open('other.out','wb') as otherOut: #注意with后面的冒号 '''print(man,file=manOut)''' '''prin原创 2017-10-12 08:59:28 · 494 阅读 · 0 评论 -
Python列表转换
new_list = [ change(each_item) for each_item in old_list ]其中change()是自定义函数,定义转换的方式原创 2017-10-12 09:07:33 · 434 阅读 · 0 评论