随笔分类 - Python
摘要:一。条件测试 符号:==, >, >=, <, <=, !=, 逻辑符号:and, or, not 测试有没在列表中 cars = ['audi', 'bmw', 'subaru', 'toyota'] for car in cars: if car != "subaru" and car != "
阅读全文
摘要:一。遍历整个列表 注意缩进,与不要遗漏冒号。 magicians = ['alice', 'david', 'carolina'] for magician in magicians: #print(magician) print(f"{magician.title()}, that waw a g
阅读全文
摘要:一。列表及使用 列表相当于其它语言的可变数组,使用下标法引用,特殊之处可以用负数的下标引用尾部元素,-1最后一个元素,-2倒数第二个元素,依此类推。 bicycles = ['trek', 'cannondale', 'redline', 'specialized'] print(bicycles)
阅读全文
摘要:一。字符串 1。双引号与单引号灵活应用 str0 = 'I told my friend, "Python is my favorite language!"' str1 = "The language 'Python' is named after Monty Python, not the sn
阅读全文
摘要:环境搭建--win10 1。安装miniconda 2。建立虚拟环境,配置windows系统Path 3。编写测试"Hello World",环境配置到conda的虚拟环境
阅读全文