《笨办法学 Python》 学习笔记02
来源:互联网 发布:隋文帝杨坚 知乎 编辑:程序博客网 时间:2024/04/30 03:12
Input
x = raw_input()y = raw_input("Name?") #这句话会用 “Name?” 提示用户z = raw_input("> ")
Import
from sys import argvscript, first, second, third = argvprint "The script is called:", scriptprint "Your first variable is:", firstprint "Your second variable is:", secondprint "Your third variable is:", third
Read and Write file
txt = open("d:\text.txt")#txt = open("d:\text.txt", 'w')print txt.read()txt.close()
close – 关闭文件。
read – 读取文件内容。你可以把结果赋给一个变量。
readline – 读取文本文件中的一行。
truncate – 清空文件,请小心使用该命令。
write(stuff) – 将stuff写入文件。
- 《笨办法学 Python》 学习笔记02
- 《笨办法学 Python》 学习笔记01
- “笨办法”学python笔记
- 《笨办法学 Python》 学习笔记04 if-while-for
- 《笨办法学 Python》 学习笔记05 —— Class
- 笨办法学python学习笔记(1~5)
- 笨办法学Python学习笔记 练习16
- 笨办法学Python学习笔记 练习17
- 笨办法学Python学习笔记 练习18
- 笨办法学Python学习笔记 练习19
- 笨办法学Python学习笔记 练习21
- 笨办法学Python学习笔记 练习25
- 笨办法学Python学习笔记 练习26
- 笨办法学Python学习笔记 练习32
- “笨办法学python”学习笔记-习题5
- “笨办法学python”学习笔记-错误整理
- “笨办法学python”学习笔记-一些附加题
- 笨办法学python的笔记之一
- HTTP协议
- http协议
- Black Hat USA 2011: Alexander Polyakov - CTO - ERPScan
- GWT EventBus
- 我要自己记住这些人的名字--不断增加
- 《笨办法学 Python》 学习笔记02
- Servlet的应用
- 网络类 UDP TCP Socket
- 黑马程序员--反射
- Note
- 代码风格(四)空格与空行
- grsecurity 总结
- Eclipse中Android项目XML文件的格式化配置
- 多线程之NSInvocationOperation