nan

0001-01-01T00:00:00Z | 1分钟阅读 | 更新于 0001-01-01T00:00:00Z

@

Python 编程-入门到实践笔记

第二章:

title():字符串首字母大写。 upper():字符串全大写。 lower():字符串全小写。

name = input("What's your name?")
name = name.title()
message = f"Hello {name} ,would you like to learn some Python today?"
print(message)
name = name.upper()
message = f"Hello {name} ,would you like to learn some Python today?"
print(message)
name = name.lower()
message = f"Hello {name} ,would you like to learn some Python today?"
print(message)  

f"{变量名}":格式化字符串,简化操作。 rstrip():临时删除字符串左边空格。 lstrip():临时删除字符串右边空格。 strip():临时删除字符串两边空格。

© 2025 - nan | BLOG

关于我

Hi,这里是 AiEDU 的博客。AiEDU 是我在互联网上经常使用的名字。

我是一个热衷于开源的研发工程师,在这里我会记录一些关于技术等知识。欢迎你通过评论或者邮件与我交流。

知识共享(Creative Commons)

此网站的所有内容都遵循 CC BY-NC-SA 4.0

All contents of this website are licensed under CC BY-NC-SA 4.0.

社交链接