Closing Files,closingfiles,# Open files
文章由Byrx.net分享于2019-03-23 07:03:38
Closing Files,closingfiles,# Open files
# Open files consume system resources, and depending on the file mode, # other programs may not be able to access them. # It's important to close files as soon as you're finished with them, as shown in # f = open('/music/_singles/kairo.mp3', 'rb') print f.closed f.close() print f print f.closed # The closed attribute of a file object indicates whether the object has # a file open or not. In this case, the file is still open (closed is False).
相关内容
- Concatenate Strings (glued together) with the + operator, and repeate
- List pop([i]),listpop,# Remove the
- Built-in function len() returns the length of a string,built-inretu
- Draw oval,drawoval,from Tkinter
- Simple Use of Locator Object Methods,locatormethods,import sysfr
- List append(x),listappend,# Add an
- And or with values in a list,valueslist,t, f = 1, 0x
- If it has a certain key,hascertain,D = {'a': 1,
- Fix Python script(s) to reference the interpreter via /usr/bin/env py
- Re design the intersect and union using tuple parameter passing,int
评论关闭