<?xml version="1.0" encoding="UTF-8" ?>
<xs:result count="31000" total="48746" cost="0.016000032424927" xmlns:xs="http://www.xunsearch.com">
  <doc index="1" percent="66%">
    <url>
      <![CDATA[https://stackoverflow.com/questions/2724348/should-i-use-import-os-path-or-import-os]]>
    </url>
    <subject>
      <![CDATA[Should I use `import os.path` or `import os`?]]>
    </subject>
    <ctype>2</ctype>
    <lang>2</lang>
    <insite>2</insite>
    <publishtime>20200929</publishtime>
    <updatetime>20200929</updatetime>
    <content>
      <![CDATA[...          


            
                
    
        answered Apr 27 '10 at 21:14
    
    
        
    
    
        Mike GrahamMike Graham
        
            60.5k1212 gold badges8484 silver badges119119 bronze badges
        
    


            
        
    
    

...]]>
    </content>
  </doc>
  <doc index="2" percent="65%">
    <url>
      <![CDATA[https://stackoverflow.com/questions/16924471/difference-between-os-getenv-and-os-environ-get]]>
    </url>
    <subject>
      <![CDATA[Difference between os.getenv and os.environ.get]]>
    </subject>
    <ctype>2</ctype>
    <lang>2</lang>
    <insite>2</insite>
    <publishtime>20201009</publishtime>
    <updatetime>20201009</updatetime>
    <content>
      <![CDATA[...


        

        


    
    
One difference observed (Python27):

os.environ raises an exception if the environmental variable does not exist.
os.getenv does not raise an exception, but returns None
    
    
        
            
            
                


    share
   ...]]>
    </content>
  </doc>
  <doc index="3" percent="65%">
    <url>
      <![CDATA[https://stackoverflow.com/questions/2860153/how-do-i-get-the-parent-directory-in-python]]>
    </url>
    <subject>
      <![CDATA[How do I get the parent directory in Python?]]>
    </subject>
    <ctype>2</ctype>
    <lang>2</lang>
    <insite>2</insite>
    <publishtime>20200929</publishtime>
    <updatetime>20200929</updatetime>
    <content>
      <![CDATA[...someday...
                
– monsur
                Aug 9 '12 at 15:27
            
        
    
    
        
            
                    46
            
        
        
            
                
                @tzot: unfortunately os.path.dirname gives different re...]]>
    </content>
  </doc>
  <doc index="4" percent="65%">
    <url>
      <![CDATA[https://stackoverflow.com/questions/11235614/how-to-detect-the-current-os-from-gradle]]>
    </url>
    <subject>
      <![CDATA[How to detect the current OS from Gradle]]>
    </subject>
    <ctype>2</ctype>
    <lang>2</lang>
    <insite>2</insite>
    <publishtime>20200930</publishtime>
    <updatetime>20200930</updatetime>
    <content>
      <![CDATA[...ot be what you expect.
                
– estani
                Jun 27 '17 at 6:01
            
        
    
    
        
            
                    2
            
        
        
            
                
                @shabunc has a better solution using org.gra...]]>
    </content>
  </doc>
  <doc index="5" percent="64%">
    <url>
      <![CDATA[https://stackoverflow.com/questions/1868714/how-do-i-copy-an-entire-directory-of-files-into-an-existing-directory-using-pyth]]>
    </url>
    <subject>
      <![CDATA[How do I copy an entire directory of files into an existing directory using Python?]]>
    </subject>
    <ctype>2</ctype>
    <lang>2</lang>
    <insite>2</insite>
    <publishtime>20200929</publishtime>
    <updatetime>20200929</updatetime>
    <content>
      <![CDATA[...copy2(s, d)
                
– Sojurn
                May 6 '15 at 7:27
                        
                            
                        
            
        
    
    
        
            
                    8
            
        
        
            
        ...]]>
    </content>
  </doc>
  <doc index="6" percent="64%">
    <url>
      <![CDATA[https://stackoverflow.com/questions/6591931/getting-file-size-in-python]]>
    </url>
    <subject>
      <![CDATA[Getting file size in Python? [duplicate]]]>
    </subject>
    <ctype>2</ctype>
    <lang>2</lang>
    <insite>2</insite>
    <publishtime>20200930</publishtime>
    <updatetime>20200930</updatetime>
    <content>
      <![CDATA[... does not exist or is inaccessible.


import os
os.path.getsize('C:\\Python27\\Lib\\genericpath.py')


Or use os.stat(path).st_size

import os
os.stat('C:\\Python27\\Lib\\genericpath.py').st_size 


Or use Path(path).stat().st_size (Python 3.4+)

from pathlib import Path
Path('C:\\Python27\\Lib\\gen...]]>
    </content>
  </doc>
  <doc index="7" percent="64%">
    <url>
      <![CDATA[https://stackoverflow.com/questions/800197/how-to-get-all-of-the-immediate-subdirectories-in-python]]>
    </url>
    <subject>
      <![CDATA[How to get all of the immediate subdirectories in Python]]>
    </subject>
    <ctype>2</ctype>
    <lang>2</lang>
    <insite>2</insite>
    <publishtime>20200929</publishtime>
    <updatetime>20200929</updatetime>
    <content>
      <![CDATA[...288
Pathlib:          34.075
Listdir:          35.501
Glob:             36.277


Tested with W7x64, Python 3.8.1. Folder with 440 subfolders.
In case you wonder if listdir could be speed up by not doing os.path.join() twice, yes, but the difference is basically nonexistent.

Code:

import os
import ...]]>
    </content>
  </doc>
  <doc index="8" percent="64%">
    <url>
      <![CDATA[https://stackoverflow.com/questions/973473/getting-a-list-of-all-subdirectories-in-the-current-directory]]>
    </url>
    <subject>
      <![CDATA[Getting a list of all subdirectories in the current directory]]>
    </subject>
    <ctype>2</ctype>
    <lang>2</lang>
    <insite>2</insite>
    <publishtime>20200929</publishtime>
    <updatetime>20200929</updatetime>
    <content>
      <![CDATA[...
                                
                                        27 Answers
                                    27
                                
                            
                            
                                
        
            Active
        
     ...]]>
    </content>
  </doc>
  <doc index="9" percent="64%">
    <url>
      <![CDATA[https://stackoverflow.com/questions/22272003/what-is-the-difference-between-os-path-basename-and-os-path-dirname]]>
    </url>
    <subject>
      <![CDATA[What is the difference between os.path.basename() and os.path.dirname()?]]>
    </subject>
    <ctype>2</ctype>
    <lang>2</lang>
    <insite>2</insite>
    <publishtime>20201009</publishtime>
    <updatetime>20201009</updatetime>
    <content>
      <![CDATA[...                     


    
        
            
        
        279
        

    
            
                
            

    
        



        

        


    
    
Both functions use the os.path.split(path) function to split the pathname path into a pair; (h...]]>
    </content>
  </doc>
  <doc index="10" percent="64%">
    <url>
      <![CDATA[https://stackoverflow.com/questions/4906977/how-to-access-environment-variable-values]]>
    </url>
    <subject>
      <![CDATA[How to access environment variable values?]]>
    </subject>
    <ctype>2</ctype>
    <lang>2</lang>
    <insite>2</insite>
    <publishtime>20200929</publishtime>
    <updatetime>20200929</updatetime>
    <content>
      <![CDATA[...   
        |


            
            

    
        edited Feb 27 '18 at 18:45
    
    
        
    
    
        Stevoisiak
        
            13.9k1616 gold badges9191 silver badges153153 bronze badges
        
    
            


            
                
    ...]]>
    </content>
  </doc>
</xs:result>
