1.os.chdir()切换到指定目录下,os.getcwd(),得到当前目录。
>>> import os
>>> os.chdir('D:\\CodeDocuments\\python code\\python head first code\\03chapter3')
>>> os.getcwd()
'D:\\CodeDocuments\\python code\\python head first code\\03chapter3'
2.print(,end='')加end='',则打印时不换行,若不加,则会换行。
>>> data=open('sketch.txt')
>>> print(data.readline(),end='')
Man: Is this the right room for an argument?
>>> print(data.readline())
Other Man: I've told you once.
>>> print(data.readline())
Man: No you haven't!
>>> print(data.readline(),end='')
Other Man: Yes I have.
3.