Python
Dove_xp
每一个不曾起舞的日子,都是对过往的辜负.
展开
-
《“笨办法”学python3》Ex 9
知识点:print的再练习连续打印多行用3个双引号括起来""""""程序:# Here's some new strange stuff, remember type it exactly.days = "Mon Tue Wed Thu Fri Sat Sun"months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"pr...原创 2018-11-09 16:51:52 · 141 阅读 · 0 评论 -
网络爬虫遇见的报错及处理方法
0.环境介绍1. pip install psutil出错-You are using pip version 10.0.1, however version 18.0 is available.2. 使用BeautifulSoup的时候提示以下错误:bs4.FeatureNotFound: Couldn't find a tree builder with the features yo...转载 2018-11-30 23:12:00 · 956 阅读 · 0 评论 -
《“笨办法”学python3》Ex 15
知识点:读取文件. 脚本读取和命令行读取. txt = open(filename)print(txt.read())file_again = input("> ")txt_again = open(file_again)print(txt_again.read())程序:from sys import argvscript, filename = argv...原创 2018-11-15 23:01:04 · 426 阅读 · 0 评论 -
《“笨办法”学python3》Ex 14
知识点练习使用 argv 和 input()程序from sys import argvscript, user_name = argvprompt = '> 'print(f"Hi {user_name}, I'm the {script} script. ")print("I'd like to ask you a few questions. ")print...原创 2018-11-15 22:49:55 · 481 阅读 · 0 评论 -
《“笨办法”学python3》Ex 8
知识点:更复杂的打印给出字符串格式多为变量,formatter = "{} {}"输出print(formatter.format(内容,内容)P.S.为什么“one”用引号,False不用:True和False是Python关键字. 程序:formatter = "{} {} {} {}"print(formatter.format(1 , 2 , 3 , ...原创 2018-11-08 19:12:26 · 363 阅读 · 0 评论 -
《“笨办法”学python3》Ex 7
知识点:print("word"*10):重复打印的方法依旧重复练习程序:print("Mary had a little lamb. ")print("Its fleece was white as {}.".format('snow'))print("And everywhere that Mary went. ")print("."*10) # what'd that...原创 2018-11-08 19:01:25 · 157 阅读 · 0 评论 -
《“笨办法”学python3》Ex 6
知识点:文本中插入变量字符串的方法print(f".......{valuable}"}w和e是两个字符串变量可以用print(w+e)直接打印程序:types_of_people = 10x = f"There are {types_of_people} types of people. "binary = "binary"do_not = "don't"y ...原创 2018-11-08 17:49:44 · 217 阅读 · 0 评论 -
《“笨办法”学python3》Ex 5
知识点:EX5是打印和变量的更多练习,其中整数转浮点数只用在在运算中加入浮点数计算,比如 5 * 5.0 = 25.0程序:my_name = 'Ping X'my_age = 23 # not a liemy_height = 161 # cmmy_weight = 51.5 # kgmy_eyes = 'Brown'my_teeth = 'White'my_hair ...原创 2018-11-08 11:34:48 · 506 阅读 · 0 评论 -
《“笨办法”学python3》Ex 2
知识点:#:注释文字程序:# A comment, this is so you can read your program later.# Anything after the # is ignored by python. \print("I could have code like this. ") # and the comment after is ignored...原创 2018-11-08 11:18:44 · 137 阅读 · 0 评论 -
《“笨办法”学python3》Ex 1
知识点:打印print用法程序:print("Hello World!")print("Hello Again")print("I like typing this.")print("This is fun.")print('Yay! Printing.')print("I'd much rather you 'not'.")print('I "said" do原创 2018-11-08 11:16:00 · 245 阅读 · 0 评论 -
《“笨办法”学python3》Ex 13
知识点:from sys import argvimport可以将python特性(模块module)引入脚本,需要什么调用什么,使得代码很小. import 也可以作为文档查script,first,second,third = argvargv是参数变量,这行代码将argv解包.将(命令行中的)输入参数赋给4个变量写一个接受参数的脚本. 按照程序输入,出现报错:no...原创 2018-11-13 11:51:53 · 889 阅读 · 0 评论 -
《“笨办法”学python3》附录+Ex 0
背景介绍:本科非计算机专业,基本零基0础 python3 入门。电脑环境:python 3.7.1 + 64位 windows系统+Atom文本编辑器笔记介绍:笔记会概述每个练习的核心内容,分享遇见的问题以及解决方案,欢迎各位批评指正。不会的部分内容参考博主从流域到海域:https://blog.csdn.net/Solo95/article/details/5044902...原创 2018-11-08 11:09:52 · 2053 阅读 · 0 评论 -
《“笨办法”学python3》Ex 12
知识点:input函数带输出的一种函数用法程序:age = input("How old are you?")height = input("How tall you are?")weight = input("How much do you weigh?")print(f"So, you're {age} old, {height} tall and {weight} he...原创 2018-11-12 22:58:48 · 213 阅读 · 0 评论 -
《“笨办法”学python3》Ex 11
知识点:引入外界输入变量 a= input()代码:print("How old are you?",end=' ')age = input()print("How tall are you?", end=' ')height = input()print("How much do you weigh?", end=' ')weight = input()print(f...原创 2018-11-12 22:52:02 · 218 阅读 · 0 评论 -
《“笨办法”学python3》Ex 10
知识点:输出转义字符转义字符 功能 \\ \ \' ' \" " \a 响铃符 \b 退格符 \f 进纸符 \n 换行符 \N{name} Unicode 数据库中字符名,name是名字 \r 回车 \t 制表符 \uxxxxx 值为16进制的xxxx字符 \v 垂...原创 2018-11-09 17:40:23 · 132 阅读 · 0 评论 -
《“笨办法”学python3》Ex 16
知识点close:关闭保存read:读取文件,可将文件赋给一个变量readline:读取文本中一行truncate:清空文件write('stuff'):将 stuff 写入文件seek(0):将读写位置放在文件开头cls:powershell清屏注:修改时参考https://www.jianshu.com/p/ce2be0faac82程序from ...原创 2019-03-14 10:01:14 · 327 阅读 · 0 评论