Show More
@@ -1445,25 +1445,16 b' def ensuredirs(name, mode=None, notindex' | |||
|
1445 | 1445 | os.chmod(name, mode) |
|
1446 | 1446 | |
|
1447 | 1447 | def readfile(path): |
|
1448 |
|
|
|
1449 | try: | |
|
1448 | with open(path, 'rb') as fp: | |
|
1450 | 1449 | return fp.read() |
|
1451 | finally: | |
|
1452 | fp.close() | |
|
1453 | 1450 | |
|
1454 | 1451 | def writefile(path, text): |
|
1455 |
|
|
|
1456 | try: | |
|
1452 | with open(path, 'wb') as fp: | |
|
1457 | 1453 | fp.write(text) |
|
1458 | finally: | |
|
1459 | fp.close() | |
|
1460 | 1454 | |
|
1461 | 1455 | def appendfile(path, text): |
|
1462 |
|
|
|
1463 | try: | |
|
1456 | with open(path, 'ab') as fp: | |
|
1464 | 1457 | fp.write(text) |
|
1465 | finally: | |
|
1466 | fp.close() | |
|
1467 | 1458 | |
|
1468 | 1459 | class chunkbuffer(object): |
|
1469 | 1460 | """Allow arbitrary sized chunks of data to be efficiently read from an |
General Comments 0
You need to be logged in to leave comments.
Login now