{article Examples__Python 3.4 }{title} {text}{/article}
Changing working directory in python shell
- import os # you can use
- os.getcwd # to get the current working directory
- os.chdir # change your directory
>>> import os
>>> os.getcwd()
'C:\\Python34'
>>> os.chdir('..')
>>> os.getcwd()
'C:\\'
>>> os.chdir('Python34')
>>> os.getcwd()
'C:\\Python34'
>>>
{source}
<!-- You can place html anywhere within the source tags -->
<pre class="brush:py;">
>>> import os
>>> os.getcwd()
'C:\\Python34'
>>> os.chdir('..')
>>> os.getcwd()
'C:\\'
>>> os.chdir('Python34')
>>> 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}