No. Use a dictionary.

>>> names = {'p1': 100, 'p2': 200}
>>> t = names['p1']
>>> t
100

This will throw a KeyError if the name does not exist:

>>> t = names['p3']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'p3'

... but you can use dict.get and provide a default value:

>>> t = names.get('p3', 'default')
>>> t
'default'

where the default-default-value is None.

(By the way, this has nothing to do with converting strings to a char(acter?), your terminology is quite confusing.)

Answer from timgeb on Stack Overflow
๐ŸŒ
WsCube Tech
wscubetech.com โ€บ resources โ€บ python โ€บ programs โ€บ string-to-char
Convert String to Char in Python (6 Programs)
2 weeks ago - Learn how to convert string to char in Python with 6 simple programs. Explore step-by-step examples, outputs, and clear explanations. Read now!
Discussions

python - Convert a list of characters into a string - Stack Overflow
If I have a list of chars: a = ['a','b','c','d'] How do I convert it into a single string? a = 'abcd' More on stackoverflow.com
๐ŸŒ stackoverflow.com
python into to char to string coversion - Stack Overflow
I am taking a cryptography course and I managed to convert a string of hex values to their int equivalents. I know want to convert these to their char equivalent using the chr(x) function that take... More on stackoverflow.com
๐ŸŒ stackoverflow.com
How do i type in {, }, " characters into a string?
in computer world, in many cases if you want to point to the exact character and not its "programming" meaning, you can "escape" it; that is writing "here is a doublequote for you: \" and here is a backslash \\". In addition, in fstrings you can user "{{" to print a {. More on reddit.com
๐ŸŒ r/learnpython
2
0
August 2, 2024
Converting a lists of characters into a list of strings
So, this *should* be a really, dead simple operation but it's been stumping me for hours today. How in the h-e-double hockeysticks do I construct a loop or series of loops to take a list of lists of characters and convert that into a list of strings? More on reddit.com
๐ŸŒ r/learnpython
36
50
December 19, 2022
People also ask

What is the easiest way for string to char in Python?
The easiest way is using unpacking: [ *text ]. If text = "Hi", it becomes ['H','i']. This method is short and clean for quickly converting a string to characters.
๐ŸŒ
wscubetech.com
wscubetech.com โ€บ resources โ€บ python โ€บ programs โ€บ string-to-char
Convert String to Char in Python (6 Programs)
Can I convert string to char array in Python with tuple instead of list?
Yes, if you use tuple("Code"), it gives ('C','o','d','e'). The only difference is that tuples are fixed and cannot be changed like lists.
๐ŸŒ
wscubetech.com
wscubetech.com โ€บ resources โ€บ python โ€บ programs โ€บ string-to-char
Convert String to Char in Python (6 Programs)
Can I access string as char without conversion in Python?
Yes, Python allows direct indexing. For example, "World"[0] gives 'W'. You donโ€™t always need to convert a string to char array if you only want to read characters one by one.
๐ŸŒ
wscubetech.com
wscubetech.com โ€บ resources โ€บ python โ€บ programs โ€บ string-to-char
Convert String to Char in Python (6 Programs)
๐ŸŒ
Sololearn
sololearn.com โ€บ en โ€บ Discuss โ€บ 1474275 โ€บ python-string-to-char-typeconversion
Sololearn: Learn to Code
sl_scroll_/en/Discuss/1196475/can-someone-explain-why-some-methods-statements-special-characters-begin-with-0-while-other-with-1Pending
๐ŸŒ
Medium
medium.com โ€บ @brahmaraokothapalli โ€บ converting-a-string-to-char-list-in-python-cc6c09f49505
Converting a string to char list in Python | by Brahma Rao Kothapalli | Medium
October 10, 2023 - my_string = "programming" # given string string_to_char_list = [] # empty list for ch in my_string: string_to_char_list.append(ch) # appending char to list print(string_to_char_list) ... In this method, I am going to use the list() built-in method. With this method, by passing the given string as an argument it converts or returns a list of characters.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ python-program-to-convert-the-string-into-an-array-of-character
Python Program to convert the array of characters into the string
June 1, 2023 - Home Whiteboard Practice Code Graphing Calculator Online Compilers Articles Tools ... Python TechnologiesDatabasesComputer ProgrammingWeb DevelopmentJava TechnologiesComputer ScienceMobile DevelopmentBig Data & AnalyticsMicrosoft TechnologiesDevOpsLatest TechnologiesMachine LearningDigital MarketingSoftware QualityManagement Tutorials View All Categories ... In Python, converting an array of characters into a string is a common task that can be accomplished using several built-in methods.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-split-string-into-list-of-characters
Split String into List of Characters in Python - GeeksforGeeks
Explanation: [*s] unpacks every character of the string s and puts each one directly into the list. We can also use a simple loop (for loop) to convert string into list of characters.
Published: November 27, 2025
Find elsewhere
๐ŸŒ
Sololearn
sololearn.com โ€บ en โ€บ Discuss โ€บ 1474275 โ€บ python-string-to-char-type-conversion
Python - String to Char type-conversion? | Sololearn: Learn to code for FREE!
how do I use type-conversion to return a type chart from a string which contains only a single letter? i.e. for word in sentence: for letter in word: someFunctionWillNeedChar=(char)letter???? ...or =char(letter)????? help? ... python does not have a char datatype..
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ string.html
string โ€” Common string operations
July 4, 2010 - It is exposed as a separate function for cases where you want to pass in a predefined dictionary of arguments, rather than unpacking and repacking the dictionary as individual arguments using the *args and **kwargs syntax. vformat() does the work of breaking up the format string into character data and replacement fields.
๐ŸŒ
Real Python
realpython.com โ€บ python-strings
Strings and Character Data in Python โ€“ Real Python
June 26, 2026 - You get the same result when you create the string with a literal emoji character. ... To convert objects into their string representation, you can use the built-in str() and repr() functions.
๐ŸŒ
Plain English
python.plainenglish.io โ€บ how-to-convert-a-string-into-a-list-of-characters-in-python-5fe97db70684
How to Convert a String into a list of Characters in Python | by Fatos Morina | Python in Plain English
September 27, 2021 - Let me repeat that again: You can pretty much simply use list() and you are going to get the string converted into a list of characters. Before we show that, let us see how we would do that in an intuitive way. We can consider each character in a string as an element, so we need to iterate through the characters just as we do with iterating through a list of elements. ... New Python content every day.
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 27923919 โ€บ python-into-to-char-to-string-coversion
python into to char to string coversion - Stack Overflow
I am taking a cryptography course and I managed to convert a string of hex values to their int equivalents. I know want to convert these to their char equivalent using the chr(x) function that takes a number from 0-255 and returns the corresponding ASCII value.
๐ŸŒ
Vultr Docs
docs.vultr.com โ€บ python โ€บ built-in โ€บ chr()
Python chr() - Convert Code to Character
December 5, 2024 - The chr() function in Python is a straightforward yet powerful tool for converting Unicode code points into characters. Its simplicity allows for effortless integration into text processing tasks, enhancing the functionality of Python scripts ...
๐ŸŒ
Quora
quora.com โ€บ How-do-you-convert-a-string-into-a-list-of-characters-in-Python
How to convert a string into a list of characters in Python - Quora
Answer (1 of 2): 1) You can use the list() function. Input: [code]string = list('In the morning when I rise..') print(string) [/code]Output: [code]['I', 'n', ' ', 't', 'h', 'e', ' ', 'm', 'o', 'r', 'n', 'i', 'n', 'g', ' ', 'w', 'h', 'e', 'n', ' ', 'I', ' ', 'r', 'i', 's', 'e', '.', '.'] [/code...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-convert-string-to-unicode-characters
Python - Convert String to unicode characters - GeeksforGeeks
July 15, 2025 - These Unicode values are appended to the unicode list, resulting in [104, 101, 108, 108, 111] for the string "hello". In this method, each character in the string is converted to its Unicode (ASCII) value using ord(char).
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ how-to-convert-an-integer-to-a-character-in-python
How to convert an integer to a character in Python?
March 24, 2026 - Converting a list of ASCII values ... message_efficient) Decoded message: Hello World Same message: Hello World ยท The chr() function converts integers to Unicode characters, with valid range 0 to 1,114,111....
๐ŸŒ
HCL GUVI
studytonight.com โ€บ python-howtos โ€บ how-to-convert-string-to-character-array-in-python
HCL GUVI | Learn to code in your native language
January 30, 2021 - Hone your bug-fixing skills with real-world debugging challenges in Python, C++, JavaScript, and Golang.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_strings.asp
Python Strings
However, Python does not have a character data type, a single character is simply a string with a length of 1. Square brackets can be used to access elements of the string.