Python I/O 文件输入输出 Python 函数 Python 脚本 Python I/O 文件输入输出 # Create a new file fo = open("/tmp/python.txt", "w") # Writes the content to the file fo.write( "This is testing for Python write...\n"); fo.write( "This is second line...\n"); # Close the file fo.close() # Open existing file fo = open("/tmp/python.txt", "r") # Read file content in a variable str = fo.read(100); print str # Close opened file fo.close() Python 函数 Python 脚本