代码改变世界

随笔档案-2017年03月

python 列表解析

2017-03-30 14:29 by 丨o聽乄雨o丨, 332 阅读, 收藏, 编辑
摘要: 列表解析函数式:[expr for iter_var in iterable] [expr for iter_var in iterable if cond_expr]exp:1.>>> seq = [11,10,9,9,5,35,8,20,31,72,54,53]>>> [x for x in s 阅读全文

rosetta mpi编译时出现 MPI has not been declared 错误

2017-03-28 09:53 by 丨o聽乄雨o丨, 933 阅读, 收藏, 编辑
摘要: 安装openmpi2.1.0版本,编译mpi rosetta时出现 MPI has not been declared 错误,经过一系列的摸索发现安装openmpi-1.6.5就可以顺利编译,降低版本就可以 这个问题就说明并不是最新版本软件是最好的。 阅读全文

linux 释放内存及查看内存命令

2017-03-18 15:11 by 丨o聽乄雨o丨, 365 阅读, 收藏, 编辑
摘要: 查看内存使用情况: free -m 清理内存: echo 1 > /proc/sys/vm/drop_caches 再次查看内存使用情况 free -m 查看内存条数命令: dmidecode | grep -A16 "Memory Device$" 阅读全文

import Tkinter error, no module named tkinter: "Python may not be configured for Tk”

2017-03-17 09:54 by 丨o聽乄雨o丨, 479 阅读, 收藏, 编辑
摘要: install required devel module in your linux: yum install tk-devel yum install tcl-devel then,reconfigure your python: ./configure make && make install 阅读全文

python 判断字符串是否包含子字符串

2017-03-09 11:09 by 丨o聽乄雨o丨, 110924 阅读, 收藏, 编辑
摘要: 第一种方法:in string = 'helloworld' if 'world' in string: print 'Exist' else: print 'Not exist' 第二种方法:find string = 'helloworld' if string.find(’world‘) == 阅读全文

python assert用法

2017-03-09 10:41 by 丨o聽乄雨o丨, 825 阅读, 收藏, 编辑
摘要: assert的异常参数,其实就是在断言表达式后添加字符串信息,用来解释断言并更好的知道是哪里出了问题。 格式如下:assert expression [, arguments]assert 表达式 [, 参数] 举个例子: string = 'helloworld' assert 'world' i 阅读全文
点击右上角即可分享
微信分享提示