![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
lpthw
小玫瑰0227
这个作者很懒,什么都没留下…
展开
-
learn python the hard way: ex 16
文章目录ex16ex16codefrom sys import argv # 引入系统的部分模块参数变量script, filename = argv, "filename" # 将参数解包并赋值给两个变量,再手动输入一个参数,否则会报错print(f"We're going to erase {filename}.") # 抹去,消除。将变量嵌入字符串并打印print("If...原创 2019-08-11 22:19:43 · 127 阅读 · 0 评论 -
learn python the hard way #exercise1~15
learn python the hard wayexercise 1source fileprint("Hello World")print("Hello Again")print("I like typing this.")print("This is fun.")print('Yay! Printing.')print("I'd much rather you 'not'."...原创 2019-07-21 21:46:07 · 219 阅读 · 0 评论 -
learn python the hard way ex17
文章目录ex17ex17这一节的内容是将一个文件中的内容复制到另外一个文件中。codefrom sys import argvfrom os.path import exists # 引入os.path模块script, from_file, to_file = argv, "test.txt", "ex15_sample.txt"print(f"Copying from {f...原创 2019-08-11 18:16:54 · 139 阅读 · 0 评论 -
learn python the hard way ex18
文章目录ex18 函数function函数功能coderesult解析ex18 函数function函数功能给代码片段命名,就像变量给字符串和数字命名一样。函数可接受参数,就跟你的脚本接受argv一样。通过使用#1和#2,它们可以让你创建“微型脚本”或者“小命令”。python中可以用def新建函数,创建4个不同函数,它们工作起来和你的脚本一样,然后演示各个函数关系。code#...原创 2019-08-11 22:17:10 · 118 阅读 · 0 评论