{article Examples__Python 3.4 }{title} {text} {readmore}{/article}

IDLE changing working directory

Checking for working directory

>>> import os
>>> os.getcwd()
'C:\\Python34'

{source}
<!-- You can place html anywhere within the source tags -->
<pre class="brush:py;">

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import os
>>> os.getcwd()
'C:\\Python34'

</pre>

<script language="javascript" type="text/javascript">
    // You can place JavaScript like this

</script>
<?php
    // You can place PHP like this

?>
{/source}

Changing current working directory

>>> import os
>>> os.chdir("/Python34/Lib/site-packages/virtualenv-1.11.6")
>>> os.getcwd()
'C:\\Python34\\Lib\\site-packages\\virtualenv-1.11.6'

{source}
<!-- You can place html anywhere within the source tags -->
<pre class="brush:py;">

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import os
>>> os.chdir("/Python34/Lib/site-packages/virtualenv-1.11.6")
>>> os.getcwd()
'C:\\Python34\\Lib\\site-packages\\virtualenv-1.11.6'

</pre>

<script language="javascript" type="text/javascript">
    // You can place JavaScript like this

</script>
<?php
    // You can place PHP like this

?>
{/source}