如何在 Python 中将变量的值更改为小写?

问题描述

如何在 Python 中将变量的值更改为小写?

例如,当“我在 KAIST 礼品教育中心学习 Python 编程”时。是这个变量的值,我如何使它“我在 kaist 天才教育中心学习 Python 编程”?

解决方法

我会尝试使用 .replace().lower()

stringEx = stringEx.lower()

输出

i study python programming at kaist center for gift education.
,

只需使用 lower 函数

string.lower()

这里是 official documents