Discuss / Python / 有个问题

有个问题

Topic source

康brother

#1 Created at ... [Delete] [Delete and Lock User]

像这种print('hello',name)输出的结果是hello 加你的名字 但是hello和你的名字之前有个空格 怎么样让他直接输出hello加名字 没有空格 直接减掉逗号好像不行

潑羅鐹

#2 Created at ... [Delete] [Delete and Lock User]

print('hello'+name)

print('hello{}'.format(name))

豆芽太羊

#4 Created at ... [Delete] [Delete and Lock User]

print('hello%s'%name)

c:\work>python iotext2.py hello,please input your name J Now,input the num, J 1024 768 1024 * 768 = 786432

附源码……

#!/usr/bin/env python3

-- coding: utf-8 --

print('hello,please input your name') name=input() print('Now,input the num,',name) int1=input() int2=input() print(int(int1),'',int(int2),'=',int(int1)int(int2))


  • 1

Reply