奇怪了,我的《python基礎教程第二版》里面寫的是
sys.path.expanduser('~/python')
使用后會有如下報錯
Traceback (most recent call last):
File "./info.py", line 6, in <module>
sys.path.expanduser('~/desktop/')
AttributeError: 'list' object has no attribute 'expanduser'
后來查了一下,發現原來這不是正確的,應該使用下面這個
os.path.expanduser('~/python/')
python版本是2.7