|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
>>> name = 'Adversity awake'
>>> saying="Man proposes, god disposes 谋事在人,成事在天"
>>> print(name+" once said"+": "+'\n\t"'+saying+'"')
Adversity awake once said:
"Man proposes, god disposes 谋事在人,成事在天"
>>> print(name.title()+" once said"+": "+'\n\t"'+saying+'"')
Adversity Awake once said:
"Man proposes, god disposes 谋事在人,成事在天"
>>> help(title)
Traceback (most recent call last):
File "<pyshell#34>", line 1, in <module>
help(title)
NameError: name 'title' is not defined
>>> print(title)
Traceback (most recent call last):
File "<pyshell#35>", line 1, in <module>
print(title)
NameError: name 'title' is not defined
我的问题:
1、>>> print(name+" once said"+": "+'\n\t"'+saying+'"'),print(name.title()+" once said"+": "+'\n\t"'+saying+'"')
两个输出结果相同,title()有什么作用呢?
2、如何查询title()的用法?
title 会把python认为是一个单词的首字母大写,可以使用 help 查看帮助,如图:
|
|