Thank you for the input. The reason I want to convert indents to tabs or spaces is that I downloaded a PDF copy (more than 1000 pages) of a book I bought. The book is a computer programming book. I want to convert the PDF to an MS Word because then I can copy the code parts and paste them on my editor so I can run them without having to indent them manually and indenting is important for this language.
Here is an example. The general text, the first 2 lines and the last one, and the indented code in between. I want if possible to select-or any other way- all the code parts and replace indents with tab or spaces.
…..only when the file is run as a top-level script, not when it is imported (this new version of the module file is renamed minmax2.py here):
print(‘I am:’, name)
def minmax(test, *args):
res = args[0]
for arg in args[1:]:
if test(arg, res):
res = arg return res
We’re also printing the value of nameat the top here to trace its value. Python creates and…….
PS..i hope the indents are visible when posted
|