Skip to content

Magenaut

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

string

How can I concatenate str and int objects?

August 22, 2022 by Magenaut

If I try to do the following:

Categories Python, Q&A Tags concatenation, python, python-2.x, python-3.x, string Leave a comment

Process escape sequences in a string in Python

August 22, 2022 by Magenaut

Sometimes when I get input from a file or the user, I get a string with escape sequences in it. I would like to process the escape sequences in the same way that Python processes escape sequences in string literals.

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

How to get the value of a variable given its name in a string?

August 22, 2022 by Magenaut

For simplicity this is a stripped down version of what I want to do: def foo(a): # I want to print the value of the variable # the name of which is contained in a I know how to do this in PHP: function foo($a) { echo $$a; } global $string = "blah"; // might … Read more

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

How to find all occurrences of a substring?

August 22, 2022 by Magenaut

Python has string.find() and string.rfind() to get the index of a substring in a string.

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

How do I execute a string containing Python code in Python?

August 22, 2022 by Magenaut

How do I execute a string containing Python code in Python?

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

Count the number of occurrences of a character in a string

August 22, 2022 by Magenaut

How do I count the number of occurrences of a character in a string?

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

How do I get the filename without the extension from a path in Python?

August 22, 2022 by Magenaut

How do I get the filename without the extension from a path in Python?

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

Convert a Unicode string to a string in Python (containing extra symbols)

August 21, 2022 by Magenaut

How do you convert a Unicode string (containing extra characters like £ $, etc.) into a Python string?

Categories Python, Q&A Tags python, string, type-conversion, unicode Leave a comment

Check if multiple strings exist in another string

August 21, 2022 by Magenaut

How can I check if any of the strings in an array exists in another string?

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

Changing one character in a string

August 21, 2022 by Magenaut

What is the easiest way in Python to replace a character in a string?

Categories Python, Q&A Tags python, string Leave a comment
Older posts
Newer posts
← Previous Page1 … Page6 Page7 Page8 … 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