描述
Python方法getcwdu()返回表示當前工作目錄的 unicode 對象。
用法
以下是語法getcwdu()方法≫
os.getcwdu()
參數
NA
返回值
此方法返回一個表示當前工作目錄的 unicode 對象。
示例
下麵的例子展示了 getcwdu() 方法的用法。
#!/usr/bin/python
import os, sys
# First go to the "/var/www/html" directory
os.chdir("/var/www/html" )
# Print current working directory
print "Current working dir:%s" % os.getcwdu()
# Now open a directory "/tmp"
fd = os.open( "/tmp", os.O_RDONLY )
# Use os.fchdir() method to change the dir
os.fchdir(fd)
# Print current working directory
print "Current working dir:%s" % os.getcwdu()
# Close opened directory.
os.close( fd )
當我們運行上麵的程序時,它會產生以下結果——
Current working dir:/var/www/html Current working dir:/tmp
相關用法
- Python os.getcwd()用法及代碼示例
- Python os.getcwdb()用法及代碼示例
- Python os.getresgid() and os.setresgid()用法及代碼示例
- Python os.getpid()用法及代碼示例
- Python os.get_blocking()用法及代碼示例
- Python os.getrandom()用法及代碼示例
- Python os.get_exec_path()用法及代碼示例
- Python os.getresuid() and os.setresuid()用法及代碼示例
- Python os.getpgid()用法及代碼示例
- Python os.getenv()用法及代碼示例
- Python os.getgid() and os.setgid()用法及代碼示例
- Python os.getuid() and os.setuid()用法及代碼示例
- Python os.getppid()用法及代碼示例
- Python os.getegid() and os.setegid()用法及代碼示例
- Python os.geteuid() and seteuid()用法及代碼示例
- Python os.getlogin()用法及代碼示例
- Python os.getpgrp()用法及代碼示例
- Python os.getenvb()用法及代碼示例
- Python os.getgroups()用法及代碼示例
- Python os.get_terminal_size()用法及代碼示例
注:本文由純淨天空篩選整理自 Python os.getcwdu() Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。