1,python是脚本(script),解释器 java,c是静态语言,编译器 "都是源代码通过解释编译成计算机语言"
2.这是简单的输入与输出,记住number的特殊(print输出数字,运算符,字符串(带引号)
name=input('name') num=int(input('number')) age=input('age') motto=input('motto') print('name:'+name) print('number:',num) print('age:'+age) print('motto:'+motto)
fs=open('fail.txt','w')#'w'是write print('say goodbye',file=fs) fs.close()
print(0b1100010) sep=('.') print('hello','back') back='helloworld' print(type(back)) print(ord('江'))#转为十进制,再用print(chr())转回 print('\u6C5F')
print('shadow\thello') a='sayhello' print('saw' in a)#输出为Flase b=True print(b) print(type(b)) print(True+9) print(False+1)#True表示1Flase表示0 #非零的布尔值都为True,零和空还有Flase,None为Flase print(bool(0)) z='hello' print(z,type(z))
3.str(type带引号)int(type数字)print(type())查询数据类型,内置函数id( ),布尔类型(上面),浮点数(小数)float‘不确定’,print(round(0.1+0.2,1))‘1表示保留位数’,索引正向0开始,反向-1开始(print(...[ ]))切片[3:7]'