Size: 1861
Comment:
|
Size: 740
Comment: 删除对PageComment2组件的引用
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## page was renamed from ObpLovelyPython/LpyAttach-answer ## page was renamed from ObpLovelyPython/Answer |
|
Line 2: | Line 4: |
#pragma section-numbers on | #pragma section-numbers off |
Line 4: | Line 6: |
||'''status'''|| 校对 || ShengYan || 完成度70%|| | ||'''status''' || 校对 || lizzie || 完成度100% || [[TableOfContents(2)]] |
Line 6: | Line 9: |
## 编辑正文收集在: ### http://openbookproject.googlecode.com/svn/trunk/LovelyPython/exercise/part2-KDays/LpyAttach3answer-KDays.moin ### http://openbookproject.googlecode.com/svn/trunk/LovelyPython/exercise/part1-CDays/LpyAttach3answer-CDays.moin |
|
Line 7: | Line 13: |
[[TableOfContents]] | ##startInc = 故事练习解答 = |
Line 9: | Line 16: |
= 故事练习解答 = == CDays == === CDays-5 === |
== CDays 故事解答 == [[Include(/CDays,,from="^##startInc",to="^##endInc")]] |
Line 13: | Line 19: |
* 计算今年是闰年嘛? | == KDays 故事解答 == [[Include(/KDays,,from="^##startInc",to="^##endInc")]] |
Line 15: | Line 22: |
* 利用python作为科学计算器。熟悉Python中的常用运算符,并分别求出表达式12*34+78-132/6、(12*(34+78)-132)/6、(8.6/4)**5的值。并利用math模块进行数学计算,分别求出145/23的余数,0.5的sin和cos值等等,详细可参考help(math)。 * 编写程序,在屏幕上打印出如下图案: === CDays-4 === * os 模块中还有哪些功能可以使用? -- 提示使用 `dir()` `help()` * `open()` 还有哪些模式可以使用? * 尝试`for .. in ..` 循环可以对哪些数据类型进行操作? * 格式化声明,还有哪些格式可以进行约定? * 现在的写入文件模式好嘛? 有改进的余地? '''CDay-4-5.py''' 好在哪里? : {{{#!python # coding : utf-8 import os export = "" for root, dirs, files in os.walk('/media/cdrom0'): export+="\n %s;%s;%s" % (root,dirs,files) open('mycd2.cdc', 'w').write(export) }}} '''CDay-4-6.py''' 又更加好在哪里? : {{{#!python # coding : utf-8 import os export = [] for root, dirs, files in os.walk('/media/cdrom0'): export.append("\n %s;%s;%s" % (root,dirs,files)) open('mycd2.cdc', 'w').write(''.join(export)) }}} * 读取文件cdays-4-test.txt内容,去除空行和注释行后,以行为单位进行排序,并将结果输出为cdays-4-result.txt。 === CDays-3 === === CDays-2 === === CDays-1 === === CDays-0 === === CDays+1 === === CDays+2 === === CDays+3 === == KDays == == 小结 == ## 总体语法等等叙述,注意给出相关知识的阅读指导 |
##endInc |
Line 67: | Line 24: |
::-- ZoomQuiet [[[DateTime(2008-04-26T07:41:41Z)]]] [[PageComment2]] |
status |
校对 |
lizzie |
完成度100% |
故事练习解答
CDays 故事解答
Include(/CDays,,from="^##startInc",to="^##endInc")
KDays 故事解答
Include(/KDays,,from="^##startInc",to="^##endInc")