这个IDE有毒。。。本地完全没问题的一段码:for k,v in d.items(): print k+':'+str(v) 到了这里就不通过了。。。也是无语
2019-04-22
print "I'm python"
print '"fool boy"'
print 'Learning "Python" is cool'
#it's error .
#print 'Bob said "I'm OK"'
print 'Bob said "I\'m OK".'
print 'Bob said \"I\'m OK\".'
#the result
I'm python
"fool boy"
Learning "Python" is cool
Bob said "I'm OK".
Bob said "I'm OK".
print '"fool boy"'
print 'Learning "Python" is cool'
#it's error .
#print 'Bob said "I'm OK"'
print 'Bob said "I\'m OK".'
print 'Bob said \"I\'m OK\".'
#the result
I'm python
"fool boy"
Learning "Python" is cool
Bob said "I'm OK".
Bob said "I'm OK".
2019-04-22
最赞回答 / 自从买了条秋裤后
先给你看一个简单的函数写法,这是一个加法函数def sum(a, b) c = a + b return c可以看到,最后用return c返回c的值,这样我们可以通过调用这个函数获得一个c的值。那么我们通过 z=sum(1, 2) 使 z 获得数值 3,然后用print z 打印出 z 的值 3 。也可以使用print sum(1, 2) ,打印出结果也是 3 。而如果我们不用return,把return改成printdef sum(a, b) c = a + b print...
2019-04-22
def firstCharUpper(s):
return s.upper()[:1]+s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
感觉s[0].upper和s.upper()[:1]一样的,我这种麻烦点
return s.upper()[:1]+s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
感觉s[0].upper和s.upper()[:1]一样的,我这种麻烦点
2019-04-22
如例子‘Bob said \"I\'m OK\”.’中,Ok后面的\he said后面的\去掉打印出来的效果是一样的,I后面的那个\是必须的。那什么时候才需要加\呢?
2019-04-22
最新回答 / 幕布斯6474709
sum=sum+x*x一,x为1,sum为0,x*x等于1,1+0=1,此时sum=1二,继续运行,x为2,sum为1,x*x=4,4+1=5,此时sum=4一直循环,最后输出sum
2019-04-21
s = 'Python was started in 1989 by "Guido".\nPython is free and easy to learn.'
print s
print s
2019-04-21
print('hello,python');
print("hello,python");
print("hello,python");
2019-04-21
代码:已通过
print((0x12fd2) + 45678);
print("Learn Python in imooc");
print(100 < 99);
print(0xff == 255);
print((0x12fd2) + 45678);
print("Learn Python in imooc");
print(100 < 99);
print(0xff == 255);
2019-04-21