zoukankan      html  css  js  c++  java
  • Python实战之文件操作的详细简单练习

    ['_CHUNK_SIZE', '__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__enter__', '__eq__', '__exit__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__lt__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_checkClosed', '_checkReadable', '_checkSeekable', '_checkWritable', '_finalizing', 'buffer', 'close', 'closed', 'detach', 'encoding', 'errors', 'fileno', 'flush', 'isatty', 'line_buffering', 'mode', 'name', 'newlines', 'read', 'readable', 'readline', 'readlines', 'seek', 'seekable', 'tell', 'truncate', 'writable', 'write', 'writelines']

    fp = open('test.py','r+',encoding='utf-8')
    data = fp.read()
    print(data)
    print("*"*60)
    # print(fp.buffer)
    # <_io.BufferedReader name='test.py'>
    
    print(fp.fileno())
    # 3
    # 文件描述符
    
    print(fp.isatty())
    # False
    
    print(fp.tell())
    # 216
    
    print(fp.flush())
    # None
    print(fp.seek(26))
    # 26
    print(fp.truncate())
    print(fp.tell())
    # 26
    print(data)
    
    fp.close()
  • 相关阅读:
    cancel-ng-swipe-right-on-child
    css.day.05.eg
    css.day05
    css.day04.eg
    css.day04
    css.day03.eg
    css.day03
    css.day02.eg
    九月十月百度人搜,阿里巴巴,腾讯华为笔试面试八十题(第331-410题)(转)
    阿里巴巴笔试题选解
  • 原文地址:https://www.cnblogs.com/william126/p/7110086.html
Copyright © 2011-2022 走看看