python学习(1)-print与input

xiaoxiao2021-02-28  99

Sublime编写代码:

print('hello,world') #输出字符串 print('xian','jiaotong','daxue') #输出多个字符串,中间用空格隔开 print('100+200',100+200) #输出整数

cmd下运行py程序:

输入:

name=input('Please input your name:') print('hello',name)

练习程序

n=123 print('n=',n) f=456.789 print('f=',f) s1="Hello,world" print('s1=',s1) s2='Hello,\'Adam\'' #\'为转义字符 print('s2=',s2) s3=r'Hello,"Bart"' #前边加r,表示对‘’中的内容不进行转义 print('s3=',s3) s4=r'''Hello Lisa!''' #三个单引号内可以输出多行内容 print('s4=',s4)

转载请注明原文地址: https://www.6miu.com/read-59491.html

最新回复(0)