Skip to content

Magenaut

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

string

str.strip() strange behavior

August 15, 2022 by Magenaut

The chars argument is a string specifying the set of characters to be removed.

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

When splitting an empty string in Python, why does split() return an empty list while split(‘n’) returns [”]?

August 15, 2022 by Magenaut

I am using split('n') to get lines in one string, and found that ''.split() returns an empty list, [], while ''.split('n') returns ['']. Is there any specific reason for such a difference?

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

Determine prefix from a set of (similar) strings

August 15, 2022 by Magenaut

I have a set of strings, e.g.

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

What is the max length of a Python string?

August 15, 2022 by Magenaut

If it is environment-independent, what is the theoretical maximum number of characters in a Python string?

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

Python Replace \ with

August 15, 2022 by Magenaut

So I can’t seem to figure this out… I have a string say, "a\nb" and I want this to become "anb". I’ve tried all the following and none seem to work;

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

Python string with space and without space at the end and immutability

August 15, 2022 by Magenaut

I learnt that in some immutable classes, __new__ may return an existing instance – this is what the int, str and tuple types sometimes do for small values.

Categories Python, Q&A Tags cpython, immutability, python, python-internals, string Leave a comment

Why is True returned when checking if an empty string is in another?

August 15, 2022 by Magenaut

My limited brain cannot understand why this happens:

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

How does the max() function work on list of strings in python?

August 15, 2022 by Magenaut

I have a list:

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

Setting variables with exec inside a function

August 15, 2022 by Magenaut

I just started self teaching Python, and I need a little help with this script:

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

Using “and” and “or” operator with Python strings

August 15, 2022 by Magenaut

parameter - A1 is evaluated to True:

Categories Python, Q&A Tags boolean-operations, python, string Leave a comment
Older posts
Newer posts
← Previous Page1 … Page27 Page28 Page29 … 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