![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python学习
佛系猿
这个作者很懒,什么都没留下…
展开
-
Mac修改默认Python版本
Mac修改默认Python版本目录Mac修改默认Python版本1.安装Python 32.查看Python3 安装路径3.打开配置文件4.写入外部环境变量5.重命名Python6.关闭文件7.终端执行命令:8.终端执行命令: python1.安装Python 32.查看Python3 安装路径打开终端,输入which python3,查看路径:/usr/bin/python3.打开配置文件open ~/.bash_profile4.写入.原创 2021-04-25 19:48:24 · 138 阅读 · 0 评论 -
python学习笔记——字符串(使用函数 str() 避免类型错误)
你经常需要在消息中使用变量的值age=25message="I'm"+age+"years old"print(message)>>>Traceback (most recent call last): File "str.py", line 2, in <module> message="I'm"+age+"years old"Typ...原创 2020-04-10 11:35:39 · 591 阅读 · 0 评论 -
python学习笔记——字符串(strip(删除多余空白))
程序中’python ‘和’python’与’ python '有很大不同,必要时要删除字符串前后的多余空白(比如:在用户登录网站时检查其用户名)Python中要删除字符串前后多余空白,可使用方法 strip()。favorite_language=' python 'print(favorite_language) #rstrip.()方法 删除...原创 2020-04-10 10:58:17 · 1468 阅读 · 0 评论 -
python学习笔记——字符串
在python中用引号(" "与’ '都可以)扩起来的都是字符串修改字符串大小写name="abC defg"print(name.title()) //title()将每个单词首字母改为大写,常用于名字print(name.upper()) //upper()将字符串全部改为大写print(name.lower()) //lower()将字符串全部改...原创 2020-04-09 12:17:45 · 100 阅读 · 0 评论 -
python学习笔记——变量
python始终记录变量的最新值python代码片// An highlighted block#print("hello,world!");test="hello,python!"print(test)message="nihao"print(message)message="nihaoma"print(message)>>>hello,python!...原创 2020-04-09 11:19:07 · 100 阅读 · 0 评论