Improved Bubble Sort

Almost every developer know how to implement the bubble sort for a simple array. We just need to travel over the array in two levels and swap the adjacent elements in the second level if their values’ order is not correct. The algorithm implement with Python is in the following Read more…

Python Edit Simple Text File

Read a single txt file and indent every paragraph. myReader.py def getText( filePath ): with open( filePath ) as file: content = file.read() paragraphs = content.split( ‘\n’ ) file.close() newContent = “” for para in paragraphs: newContent = newContent + ” ” + para + “\n” return newContent main.py import Read more…

Use Python To Handle Simple PDF Edit Tasks

The article shows a few simple examples which use python to edit PDF. Copy And Encrypt PDF Just copy an existing PDF and generate a new file which is encrypted import PyPDF2 fileName = “/Users/weiyang/Desktop/Test.pdf” newFileName = “/Users/weiyang/Desktop/NewTest.pdf” file = open( fileName, ‘rb’ ) reader = PyPDF2.PdfFileReader( file ) writer Read more…

XML To JSON
: Input your strings, the tool can convert XML to JSON for you.

X