Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

text

How can I remove non-ASCII characters but leave periods and spaces?

August 19, 2022 by Magenaut

I’m working with a .txt file. I want a string of the text from the file with no non-ASCII characters. However, I want to leave spaces and periods. At present, I’m stripping those too. Here’s the code:

Categories Python, Q&A Tags ascii, filter, python, text, unicode Leave a comment

Inserting Line at Specified Position of a Text File

August 18, 2022 by Magenaut

I have a text file which looks like this:

Categories Python, Q&A Tags insert, python, text Leave a comment

Only extracting text from this element, not its children

August 18, 2022 by Magenaut

I want to extract only the text from the top-most element of my soup; however soup.text gives the text of all the child elements as well:

Categories Python, Q&A Tags beautifulsoup, parsing, python, text Leave a comment

Editing workbooks with rich text in openpyxl

August 18, 2022 by Magenaut

I was wondering if openpyxl can read and/or write rich text into excel. I am aware that this question was asked once before in 2012 linked below, but I am not sure if this has changed.

Categories Python, Q&A Tags excel, openpyxl, python, text Leave a comment

Check if string contains only whitespace

August 17, 2022 by Magenaut

How can I test if a string contains only whitespace?

Categories Python, Q&A Tags python, text, whitespace Leave a comment

How can I escape latex code received through user input?

August 16, 2022 by Magenaut

I read in a string from a GUI textbox entered by the user and process it through pandoc. The string contains latex directives for math which have backslash characters. I want to send in the string as a raw string to pandoc for processing. But something like “theta” becomes a tab and “heta”.

Categories Python, Q&A Tags python, string, text Leave a comment

How to use python-docx to replace text in a Word document and save

August 15, 2022 by Magenaut

The oodocx module mentioned in the same page refers the user to an /examples folder that does not seem to be there.
I have read the documentation of python-docx 0.7.2, plus everything I could find in Stackoverflow on the subject, so please believe that I have done my “homework”.

Categories Python, Q&A Tags ms-word, python, python-docx, replace, text Leave a comment

Remove very last character in file

August 14, 2022 by Magenaut

After looking all over the Internet, I’ve come to this.

Categories Python, Q&A Tags file, python, text Leave a comment

In Python, how do I decode GZIP encoding?

August 13, 2022 by Magenaut

I downloaded a webpage in my python script.
In most cases, this works fine.

Categories Python, Q&A Tags ascii, encoding, http, python, text Leave a comment

Delete final line in file with python

August 13, 2022 by Magenaut

How can one delete the very last line of a file with python?

Categories Python, Q&A Tags line, python, text Leave a comment
Older posts
Newer posts
← Previous Page1 Page2 Page3 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress