随笔分类 -  python

python相关
摘要:网络摘抄:http://ddrv.cn/a/195811 https://www.cnblogs.com/feiyafei/p/10155616.html 总共三种办法,推荐1/2。尽量不用3。 1. 在site-package下添加.path文件(如果是两套python,就需要添加两个位置) 在D 阅读全文
posted @ 2021-02-05 10:57 静惜 阅读(1744) 评论(0) 推荐(0)
摘要:# 字符串格式化 format函数 # 通过位置参数,按照位置顺序替换前面的{}占位符 s1 = "name:{}, socre:{}".format("tom",89) # 关键字参数或命名参数 s2 = "name:{0},socre:{score} ".format("tom",score=9 阅读全文
posted @ 2021-01-21 09:13 静惜 阅读(179) 评论(0) 推荐(0)
摘要:#字符串支持索引访问,是有序的,可迭代的。 #join 连接,参数是一个可迭代类型,而且必须是字符型的 str1 = "a good day" str2 = ['this','is','good'] print('*'.join(str1)) print('*'.join(str2)) ​ a* * 阅读全文
posted @ 2021-01-20 17:46 静惜 阅读(77) 评论(0) 推荐(0)