摘要:
--安装依赖包 yum -y install compat-libcap1 compat-libstdc++ gcc gcc-c++ glibc-devel libaio-devel libstdc++-devel ksh numactl numactl-devel motif motif-deve 阅读全文
摘要:
--原来的不动,添加环境变量(.bash_profile)export JAVA_HOME=/home/public/jdk1.8.0_131export JRE_HOME=$JAVA_HOME/jreexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HO 阅读全文
摘要:
import random x = int(input('Enter a number for x: ')) --随机数最小值y = int(input('Enter a number for y: ')) --随机数最大值 n = int(input('How many numbers do yo 阅读全文
摘要:
--raise >>> raise IOError('This is a test!') Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> raise IOError('This is a test! 阅读全文
摘要:
>>> class Person: def __init__(self, name, age): self.name = name self.age = age def display(self): print(self.name, self.age) >>> p = Person('john', 阅读全文
摘要:
os.getcwd() 表示当前目录,可以换成其他目录路径 --返回当前目录中的文件夹和文件 >>> import os >>> os.listdir(os.getcwd()) ['01成品代码', '@test.py', 'addtofile1.py', 'class.py', 'class1.p 阅读全文
摘要:
--设置字符串格式 >>> x = 0.123456789 >>> print('value : %.2f' % x) value : 0.12 >>> >>> x = 0.123456789 >>> y = 0.123456789 >>> print('x = %.2f y = %.3f' % ( 阅读全文
摘要:
>>> i = 0 >>> while i < 10: print(i) i = i + 1 0 1 2 3 4 5 6 7 8 9 阅读全文
摘要:
>>> for i in range(5): print(i) 0 1 2 3 4 >>> for i in range(0, 5): print(i) 0 1 2 3 4 >>> for i in range(1, 5): print(i) 1 2 3 4 >>> for i in range(5 阅读全文
摘要:
# if.py pwd = input('What is the password? ') if pwd == 'apple': print('Logging on ...') else: print('Incorrect password.') 运行结果: >>> What is the pass 阅读全文