Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28768 > unrolled thread
| Started by | iMath <redstone-cold@163.com> |
|---|---|
| First post | 2012-09-09 06:22 -0700 |
| Last post | 2012-09-26 23:26 -0700 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.lang.python
Does os.getcwd() and os.curdir have the same effect ? iMath <redstone-cold@163.com> - 2012-09-09 06:22 -0700
Re: Does os.getcwd() and os.curdir have the same effect ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-09 13:38 +0000
Re: Does os.getcwd() and os.curdir have the same effect ? Thomas Jollans <t@jollybox.de> - 2012-09-09 15:39 +0200
Re: Does os.getcwd() and os.curdir have the same effect ? iMath <redstone-cold@163.com> - 2012-09-26 23:26 -0700
Re: Does os.getcwd() and os.curdir have the same effect ? iMath <redstone-cold@163.com> - 2012-09-26 23:26 -0700
| From | iMath <redstone-cold@163.com> |
|---|---|
| Date | 2012-09-09 06:22 -0700 |
| Subject | Does os.getcwd() and os.curdir have the same effect ? |
| Message-ID | <12b64802-d598-441b-b3cd-87ec17bba514@googlegroups.com> |
Does os.getcwd() and os.curdir have the same effect ?
[toc] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2012-09-09 13:38 +0000 |
| Message-ID | <504c9bc8$0$29981$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #28768 |
On Sun, 09 Sep 2012 06:22:09 -0700, iMath wrote: > Does os.getcwd() and os.curdir have the same effect ? You could answer that yourself with two seconds experimentation at the interactive prompt. py> os.getcwd() '/home/steve' py> os.curdir '.' For more information, you can try reading the Fine Manual: http://docs.python.org/library/os.html#os.getcwd http://docs.python.org/library/os.html#os.curdir In case it isn't obvious: no, they are completely different. os.getcwd is a function which returns the path of the current working directory. os.curdir is a string which the operating system will understand to mean "this directory". -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Thomas Jollans <t@jollybox.de> |
|---|---|
| Date | 2012-09-09 15:39 +0200 |
| Message-ID | <mailman.417.1347197960.27098.python-list@python.org> |
| In reply to | #28768 |
On 09/09/2012 03:22 PM, iMath wrote: > Does os.getcwd() and os.curdir have the same effect ? > Python 3.2.3 (default, May 3 2012, 15:51:42) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.getcwd() '/home/tjol' >>> os.curdir '.' >>> No. Both refer to the current directory, but os.curdir is not an absolute path, so you can't chdir() to it later and expect to land it the original directory.
[toc] | [prev] | [next] | [standalone]
| From | iMath <redstone-cold@163.com> |
|---|---|
| Date | 2012-09-26 23:26 -0700 |
| Message-ID | <15bbb5f2-2242-44db-b97d-ba15cb8843b3@googlegroups.com> |
| In reply to | #28772 |
On Sunday, September 9, 2012 9:39:28 PM UTC+8, Thomas Jollans wrote: > On 09/09/2012 03:22 PM, iMath wrote: > Does os.getcwd() and os.curdir have the same effect ? > Python 3.2.3 (default, May 3 2012, 15:51:42) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.getcwd() '/home/tjol' >>> os.curdir '.' >>> No. Both refer to the current directory, but os.curdir is not an absolute path, so you can't chdir() to it later and expect to land it the original directory. get it ,thanks
[toc] | [prev] | [next] | [standalone]
| From | iMath <redstone-cold@163.com> |
|---|---|
| Date | 2012-09-26 23:26 -0700 |
| Message-ID | <mailman.1476.1348727202.27098.python-list@python.org> |
| In reply to | #28772 |
On Sunday, September 9, 2012 9:39:28 PM UTC+8, Thomas Jollans wrote: > On 09/09/2012 03:22 PM, iMath wrote: > Does os.getcwd() and os.curdir have the same effect ? > Python 3.2.3 (default, May 3 2012, 15:51:42) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.getcwd() '/home/tjol' >>> os.curdir '.' >>> No. Both refer to the current directory, but os.curdir is not an absolute path, so you can't chdir() to it later and expect to land it the original directory. get it ,thanks
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web