Skip to content
Advertisement

Tag: character

Python: Check for unique characters on a String

I’m asking the user to input a keyword and then remove any duplicate characters. Example: Input: balloon Output: balon I’ve tried this solution: List of all unique characters in a string? but it marks it as a syntax error. Any ideas? Answer For your answer, order is important. Here is a one line solution:

What is the difference between a string and a byte string?

I am working with a library which returns a “byte string” (bytes) and I need to convert this to a string. Is there actually a difference between those two things? How are they related, and how can I do the conversion? Answer Assuming Python 3 (in Python 2, this difference is a little less well-defined) – a string is a

Advertisement