0
A
回答
3
我相信这将是非常简单的,你
os.path.abspath(os.path.pardir)
或者也可以简单
os.path.dirname(os.getcwd())
1
我不知道,做它的方法,但我会做这样的事情:
os.path.abspath(os.path.join(os.getcwd(), os.pardir))
编辑:这样的作品,但Ixanezis方式可能会更好。
1
那么,这种方法可能是有用的:
os.path.dirname(os.getcwd())
相关问题
- 1. Python的等价物@
- 2. document.getElementsByClassName的等价物
- 3. iOS等价物onRestart()
- 4. Python等价物repr()?
- 5. VB.NET HashMap等价物
- 6. BufferedImage.getRGB C#等价物?
- 7. Ext JS等价物
- 8. Golang requirements.txt等价物
- 9. TSQL/MySQL等价物
- 10. OrderedDict的list.index()的等价物?
- 11. Unix的pdfinfo的等价物
- 12. Db的List.exists的等价物
- 13. CCLayer的-viewDidAppear的等价物?
- 14. Ruby的cURL的等价物?
- 15. Phoenix的Rails.env.production的等价物?
- 16. PostgreSQL的mysql_insert_id()的等价物?
- 17. Windows的gettimeday()的等价物
- 18. AS2中Event.MOUSE_LEAVE的等价物
- 19. SQL的等价物mysqli_real_escape_string
- 20. tcl中#define的等价物?
- 21. 代码的LINQ等价物?
- 22. Sinatra的Python等价物
- 23. DataGrid中CellMouseEnter的等价物?
- 24. C#中func_get_arg的等价物?
- 25. WPF中的PagedCollectionView等价物?
- 26. php的Javascript等价物move_uploaded_file
- 27. DCMPLX的现代等价物?
- 28. 'pat2cwav'的Python等价物
- 29. Mathematica中的Sprintf等价物?
- 30. Class.forName的Gradle等价物
[获取父母的可能重复目录在Python中](http://stackoverflow.com/questions/2860153/get-parent-directory-in-python) – 2012-04-09 19:46:19
Plea我不认为'os.set =='/''就是这样。在'os.path'中有现成的函数:'split','join','basename'等。 – delnan 2012-04-09 19:50:45