Skip to content

Magenaut

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

string

Python – How can I pad a string with spaces from the right and left?

August 11, 2022 by Magenaut

I have two scenarios where I need to pad a string with whitespaces up to a certain length, in both the left and right directions (in separate cases). For instance, I have the string:

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

Convert a string to integer with decimal in Python

August 11, 2022 by Magenaut

I have a string in the format: ‘nn.nnnnn’ in Python, and I’d like to convert it to an integer.

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

how to do bitwise exclusive or of two strings in python?

August 11, 2022 by Magenaut

I would like to perform a bitwise exclusive or of two strings in python, but xor of strings are not allowed in python. How can I do it ?

Categories Python, Q&A Tags bitwise-operators, python, string Leave a comment

Replace n with

August 11, 2022 by Magenaut

I’m parsing text from file with Python. I have to replace all newlines (n) with
cause this text will build html-content. For example, here is some line from file:

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

Plural String Formatting

August 11, 2022 by Magenaut

Given a dictionary of ints, I’m trying to format a string with each number, and a pluralization of the item.

Categories Python, Q&A Tags customization, python, string, string-formatting Leave a comment

Replace space with new line

August 10, 2022 by Magenaut

How can I replace spaces with new lines on an input like:

Categories Q&A, Unix & Linux Tags string, text-processing Leave a comment

Add thousands separator in a number

August 10, 2022 by Magenaut

In python

Categories Q&A, Unix & Linux Tags awk, bash, shell-script, string Leave a comment

Splitting string by the first occurrence of a delimiter

August 10, 2022 by Magenaut

I have a string in the next format

Categories Q&A, Unix & Linux Tags bash, shell-script, split, string Leave a comment

Shell test to find a pattern in a string

August 9, 2022 by Magenaut

I just wanted to ask whether there is any command which would work on common shells (bash, dash, kornshell)? It is supposed to check if the line variable contains any part of the path.

Categories Q&A, Unix & Linux Tags regular-expression, shell, string Leave a comment

Padding trailing whitespaces in a string with another character

August 9, 2022 by Magenaut

I’d like to output hello world over 20 characters.

Categories Q&A, Unix & Linux Tags bash, printf, shell, string Leave a comment
Older posts
Newer posts
← Previous Page1 … Page37 Page38 Page39 Page40 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