GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — PCV/expand_tabs.py at master · Susan25/PCV

Expand file tree

/

expand_tabs.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
28 lines (23 loc) · 784 Bytes
/

expand_tabs.py

Copy path

File metadata and controls

28 lines (23 loc) · 784 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import re
reg_pyfile=re.compile(r'.*\.py$',re.I)
def expand_tabs(file0):
'''
This function takes the name of a python source file, expands all tabs to 4 spaces (for
PEP 8 compliance), and rewrites the file in place.
'''
str_file_contents=open(file0,'rb').read()
str_pep_contents=str_file_contents.replace('\x09',4*'\x20')
open(file0,'wb').write(str_pep_contents)
return None
def pepify_directory(path_root):
for (path,subdir,lst_file) in os.walk(path_root):
for file0 in (file1 for file1 in lst_file if reg_pyfile.match(file1)):
expand_tabs(os.path.join(path,file0))
print(os.path.join(path,file0))
pass
pass
return None
if __name__=='__main__':
pepify_directory('.')
pass
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.