#!/usr/bin/env python
# *_* coding=utf-8 *_* """
desc: 文件方法 #############################
file.read() #read([size]) -> read at most size bytes, returned as a string.
file.readline() readline([size]) -> next line from the file, as a string.
file.readlines()
readlines([size]) -> list of strings, each a line from the file.
Call readline() repeatedly and return a list of the lines so read.
The optional size argument, if given, is an approximate bound on the
total number of bytes in the lines returned.
file.xreadlines() xreadlines() -> returns self. file.write() write(str) -> None. Write string str to file.
file.writelines()
writelines(sequence_of_strings) -> None. Write the strings to the file.
Note that newlines are not added. The sequence can be any iterable object
producing strings. This is equivalent to calling write() for each string. file.truncate()
truncate([size]) -> None. Truncate the file to at most size bytes.
Size defaults to the current file position, as returned by tell(). file.seek()
seek(offset [,whence])方法改变当前文件的位置。Offset变量表示要移动的字节数。From变量指定开始移动字节的参考位置。
如果from被设为0,这意味着将文件的开头作为移动字节的参考位置。如果设为1,则使用当前的位置作为参考位置。如果它被设为2,那么该文件的末尾将作为参考位置。 file.flush()
file.tell() current file position, an integer (may be a long integer).
file.next() file.close() ############不常用的方法#############
file.closed
file.mode
file.name file.isatty() # true or false. True if the file is connected to a tty device.
file.readinto() #不用用这个
file.encoding # 不常用
file.errors # 不常用
file.newline # 不常用
file.softspace
file.fileno()
fileno() -> integer "file descriptor".
This is needed for lower-level file interfaces, such os.read(). ###############################
version: 1.0
""" fo= open("e:/temp.txt",'r')
print "文件名: ", fo.name
print "是否已关闭 : ", fo.closed
print "访问模式 : ", fo.mode
print "末尾是否强制加空格 : ", fo.softspace

  

最新文章

  1. .Net MVC 网站中配置文件的读写
  2. ctypes 调用 dll
  3. ABAP 读取销售订单抬头文本自建函数
  4. SQL: ROW_NUMBER
  5. Validform —— 再也不用担心“表单验证”!
  6. myeclipse+tomcat 工程名改名的问题 ——————完美解决方案
  7. Hbase WAL线程模型源码分析
  8. Java数据库连接——JDBC调用存储过程,事务管理和高级应用
  9. CE_现金银行对账单的手工导入和调节(案例)
  10. 对QT的理解——能在公司里不做Java,不做很偏门的产品,不使用偏门的语言,还有钱挣,要有感恩的心
  11. StudioStyle 使用 厌倦了默认的Visutal Studio样式了,到这里找一个酷的试试
  12. java.lang.ClassNotFoundException: com.mysql.jdbc.Driver问题
  13. SGU 194 Reactor Cooling ——网络流
  14. 排序问题思考(要求时间和空间复杂度尽可能的低)【Part 2】
  15. Mac本地编辑服务器代码
  16. C++实现多级排序
  17. JavaScript js 引入CDN 不生效 注意事项
  18. Mad Libs 游戏
  19. Vue 开发经验总结
  20. CF1083E The Fair Nut and Rectangles

热门文章

  1. 定时杀死mysql中sleep的进程
  2. 精通react之react-router4源码分析(100代码实现router功能)
  3. 57 容器(十一)——Collections容器工具类
  4. Django框架(十二)-- 中间件、CSRF跨站请求伪造
  5. java网站架构演变过程
  6. php GD 和图像处理函数, 制作一张图片
  7. 高性能Golang研讨会【精】
  8. Java框架之MyBatis框架(一)
  9. Firebird 事务隔离级别
  10. 【书评:Oracle查询优化改写】第三章