python输入语句是什么意思_Python输入语句,python

一、输出语句print()

##1、引号的使用

双引号 ""

单引号 ''

三引号 """...""", '''....'''

print(“hello world”)

print(‘hello python’)

print(“select * from tb01 where name=‘martin’”)

print(“MySQL\nRedis\nMongodb”)

print(""“Linux

Unix

Windows

MacOS”"")

print(“python自动化运维”)

##2、输出变量值

username = “Martin”

print(username)

print(“hello”, username)

##3、格式化输出

常用占位符:

%s字符串占位

username = "Martin"

password = "redhat"

age = 30

print("My name is ‘%s’" % username)

print("My name is '%s', My age is %s." % (username, age))

print("select * from tb01 where name='%s' and password='%s'" % (username, password))

%d 整数

print("The number is %d" % 100)

print("The number is %d" % 3.56634)

%f 浮点数

print("The number is %f" % 100)

print("The number is %f" % 3.1415926)

print("The number is %.4f" % 3.1415926)

%%%本身

number = 50

print("This is %d%%" % number)

##4、取消print自带的换行

print("hello world",end="")

print("hello python")

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值