語学学習のスペースアルク(SPACE ALC)がお届けする進化するオンライン英和・和英辞書『英辞郎 on the WEB』。大学生やビジネスパースンから翻訳家、医療・製薬業関係者の方々まで幅広くお使いいただいております。
ALC Online Shop

英辞郎データ提供元 EDP のサイトへ
検索文字列 作業ディレクトリ 該当件数 : 14
* データの転載は禁じられています。  
  • 作業ディレクトリ
    working directory《コ》
  • globパターンの中でワイルドカードを複数回使うこともできる。この例では、現在の作業ディレクトリの中から.pyという拡張子で終わり、testという単語をファイル名のどこかに含むファイルを見つけ出す。
    You can include multiple wildcards in your glob pattern. This example finds all the files in the current working directory that end in a .py extension and contain the word test anywhere in their filename.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • osモジュールには、現在の作業ディレクトリを扱うための二つの関数が入っている。
    The os module contains two functions to deal with the current working directory.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • 「現在の作業ディレクトリ」は、Pythonがメモリの中に常に保持している見えない属性だ。現在の作業ディレクトリは、Pythonシェルにいるときも、コマンドラインからPythonスクリプトを実行しているときも、PythonのCGIスクリプトをWebサーバ上で実行しているときも、常に存在する。
    The current working directory is an invisible property that Python holds in memory at all times. There is always a current working directory, whether you're in the Python Shell, running your own Python script from the command line, or running a Python CGI script on a web server somewhere.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • このリスト内包表記は現在の作業ディレクトリにあるすべての.xmlファイルを探しだし、そのファイルサイズを(os.stat()関数を呼び出して)取得し、ファイルサイズと(os.path.realpath()関数で取得した)絶対パスから成るタプルを返す。
    This list comprehension finds all the .xml files in the current working directory, gets the size of each file (by calling the os.stat() function), and constructs a tuple of the file size and the absolute path of each file (by calling the os.path.realpath() function).〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • これは、現在の作業ディレクトリに含まれるすべての.xmlファイルのリストを返す。
    This returns a list of all the .xml files in the current working directory.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • たとえば、/home/my_user/binと、現在の作業ディレクトリ(現在あなたがいるディレクトリ)をPATH変数に設定したいけれども、同じシステムにいる他のユーザーのPATHには追加させたくない、という場合です。
    For instance, you might want to add /home/my_user/bin and the current workingdirectory (the directory you are in) to the PATH variable but don't want all other users on your system to have that in their PATH too.〔【出典】Gentoo Linux 【License】CC-BY-SA-2.5 【編集】独立行政法人情報通信研究機構
  • もし、現在の作業ディレクトリ (current working directory) について知らないのなら、ステップ1は恐らくImportErrorを出して失敗するだろう。なぜかって? なぜならPythonは、Import検索パスの中からexampleモジュールを探し出そうとするが、examplesフォルダは検索パスのどこにもないので見つけ出すことができないからだ。この問題を解決するには、次の二つのうちのどちらか一つを行えばいい:
    If you don't know about the current working directory, step 1 will probably fail with an ImportError. Why? Because Python will look for the example module in the import search path, but it won't find it because the examples folder isn't one of the directories in the search path. To get past this, you can do one of two things:〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • ディレクトリごとにコマンドファイルを持って、そこを作業ディレクトリにしてデバッガを起動すると、それが勝手にロードされるようにしておける。
    You can have a command file in each directory, that will be loaded automatically when you start the debugger with that as your working directory.〔【出典】日英対訳文・対応付けデータ(独立行政法人情報通信研究機構)〕"_RMS3", "2575015"
  • リストをフィルタリングするために、リスト内包表記の最後にif節を付け加えることができる。ifキーワードの後ろの式はリストの各要素に対して評価され、各要素は式がTrueと評価された場合に出力に加えられる。このリスト内包表記は、現在の作業ディレクトリにあるすべての.pyファイルのリストを見て、各々のファイルが6000バイトよりも大きいかどうかをif式で検査している。そのようなファイルは六つあるので、リスト内包表記は六つのファイル名を含んだリストを返す。
    To filter a list, you can include an if clause at the end of the list comprehension. The expression after the if keyword will be evaluated for each item in the list. If the expression evaluates to True, the item will be included in the output. This list comprehension looks at the list of all .py files in the current directory, and the if expression filters that list by testing whether the size of each file is greater than 6000 bytes. There are six such files, so the list comprehension returns a list of six filenames.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • 今度は、現在の作業ディレクトリをexamplesに変更した。os.chdir()関数は相対パスを受け取れるのだ。
    Now change the current working directory to the examples subdirectory. The os.chdir() function can take relative pathnames.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • 前節では、glob.glob()関数が相対パスを返すことを見た。一つ目の例は'examples¥feed.xml'のようなパス名であり、二つ目の例はさらに短い'romantest1.py'のような相対パス名だった。同じ作業ディレクトリにいる限り、このような相対パス名であっても、問題なくファイルを開いたりメタデータを取得したりできるだろう。しかし、絶対パス名(つまり、ルートディレクトリやドライブレターに至るまでの、すべてのディレクトリを含むパス名)を作りたいのであれば、os.path.readpath()関数が必要になる。
    In the previous section, the glob.glob() function returned a list of relative pathnames. The first example had pathnames like 'examples¥feed.xml', and the second example had even shorter relative pathnames like 'romantest1.py'. As long as you stay in the same current working directory, these relative pathnames will work for opening files or getting file metadata. But if you want to construct an absolute pathname -- i.e. one that includes all the directory names back to the root directory or drive letter -- then you'll need the os.path.realpath() function.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • 現在の作業ディレクトリを変更するには、os.chdir()関数を使えばいい。
    Use the os.chdir() function to change the current working directory.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0
  • 現在の作業ディレクトリを知るには、os.getcwd()関数を使えばいい。グラフィカルなPythonシェルを使っている場合、現在の作業ディレクトリの初期値は、Pythonシェルの実行ファイルがある場所になっている。Windowsでは、Pythonをインストールした場所に依存するが、デフォルトのディレクトリはc:¥Python31だ。コマンドラインからPythonシェルを起動した場合の現在の作業ディレクトリは、python3を起動したときに居たディレクトリになっている。
    Use the os.getcwd() function to get the current working directory. When you run the graphical Python Shell, the current working directory starts as the directory where the Python Shell executable is. On Windows, this depends on where you installed Python; the default directory is c:¥Python31. If you run the Python Shell from the command line, the current working directory starts as the directory you were in when you ran python3.〔【出典】"Dive Into Python 3" by Mark Pilgrim 【和訳】Fukada & Fujimoto 【License】CC-BY-SA-3.0