- 博客(10)
- 收藏
- 关注
原创 onenote代码高亮操作步骤
在onenote的“快速访问工具栏中”添加“插入表格”和“底纹”。 将“插入表格”和“底纹”放在工具栏的第三和第四个位置以方便操作。 以pycharm为例,复制代码,粘贴到word中,然后从word中复制刚刚粘贴的代码。 转入onenote界面,快捷键ALT+3调用“插入表格”,行和列均选择“1”,再使用快捷键ALT+4,调用“底纹”命令,改底纹颜色为黑色 粘贴代码至表格中,粘贴方式选怎“合并格...
2019-11-08 16:28:16
1389
原创 笨方法学pyhon 练习41
敲了小一个小时才敲完的,代码如下,拿走不谢 from sys import exit from random import randint def death(): quips = ["You died. You kinda suck at this.", "Nice job, you died...jackass.", "Such a...
2019-11-14 23:20:25
218
原创 笨办法学python 练习40字典
这一节练习我看了很久,主要纠结在两个地方: cities['_find'] = find_city city_found = cities['_find'](cities,state) 这两个地方其实练习41有讲到原理,但是刚开始我理解不了,感觉代码写的非常绕。后来才发现作者是为了在代码中体现字典的作用而故意这样写的。。。 以下附上源代码以及最后两行改进的代码 cities = {'CA': '...
2019-11-14 21:21:49
235
原创 笨方法学python 练习26 考试
改正代码如下 def break_words(stuff): """This function will break up words for us.""" words = stuff.split(' ') return words def sort_words(words): """Sorts the words.""" return sorted(wo...
2019-11-09 22:07:16
142
原创 笨办法学python练习17
先上代码 from sys import argv from os.path import exists script,from_file,to_file = argv # 解包 print("Copying from %s to %s" %(from_file,to_file)) # 打印,从A复制粘粘贴到B # we could do these two on one line to...
2019-11-08 17:25:53
473
原创 笨办法学python 练习15.读取文件
先上代码 from sys import argv script , filename = argv # filename 这个名字的文件夹需要提前存在,与py文件在同一目录下 txt = open(filename) print("Here's your file %r:" %filename) print(txt.read()) # 读取txt中存在的内容 txt.close() # 清...
2019-11-08 17:16:57
311
1
原创 笨方法学python 练习13.参数、解包、变量
先上原文代码 from sys import argv # argv是参数变量,变量包含我传递给python的参数 yes, I, Love, You = argv # 随便哪四个变量都行 # 解包过程,将所有参数依次传递给左边变量 more = input('请输入更多参数:') print("The script is called:",yes) print("Your first var...
2019-11-08 17:03:08
313
原创 笨方法学python练习7.更多打印
print('Mary had a little lamb.') print("Its fleece was white as %s." %'snow') # 若格式化字符串为string类型,则加双引号 print("And everywhere that Mary went.") print("."*10) end1 = 'C' end2 = 'h' end3 = 'e' end4 = '...
2019-11-08 16:40:44
152
原创 笨方法学python-5 更多的变量和打印
这一节学习了格式化符号的用法 我理解的格式化符号其实就等同于占位符 text = " i’m a student " print (" I said %s " %text) 结果:I said i’m a student 如上述代码,先对text进行赋值,而后利用%s进行代替输入。 但有一点不明白,为何不直接填写: print(’‘I said’,text ), 其结果是相同的,如果如此,不是多...
2019-10-27 14:04:16
125
原创 笨方法学Python-1
笨方法学Python-1 本人初学python,偶得《笨方法学python-第四版》,惊为天人,到第一个习题时,发现虽然内容很简单,但是卡壳的地方很多,记录下,是以纪念。 1.出现powershell无法识别python的情况,需在电脑系统的环境变量中加入python,具体操作可百度“python如何设置环境变量”。 2.在打完代码之后在powershell运行ex1.py时出现C:\Users\...
2019-10-22 21:41:17
491
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅