chr() is a function in Python or PHP which returns the character (string of length one) that corresponds to an ASCII code point.
Questions tagged [chr]
166 questions
0
votes
1 answer
vb.net char literal for integer
Using the commandline visual basic compiler (vbc.exe) with option VBruntime-
does not allow using chr() or chrw() to specify a literal char.
MSDN gives "x"c as solution to specify a literal character.
That works fine, but how can i specify a literal…
user700202
-1
votes
1 answer
In python, how would I convert a list of different length numbers to a list the same ascii characters?
I have a list of numbers:
a = [2, 2, 30, 1, 30, 6, 3, 30, 0, 9, 4, 30, 1, 30, 1, 29]
I am trying to convert the list from integers to ascii characters of the same number before converting them to hex. I am running into trouble figuring out how to…

Sean Mckay
- 3
- 2
-1
votes
1 answer
why does it say Syntax,Error: invalid syntax at line 5
from random import*
def saisie():
ch1=""
for i in range (1,9):
ch1[i]=chr(randint(ord'A',ord'Z'))
ch1=ch1+ch1[i]
return ch1
i wanted to get a word randomly selected with capital and 8 letters

Ella Farhat
- 1
- 1
-1
votes
3 answers
Why do I keep getting an error that the chr() value is out of range?
CODE:
from tkinter import *
from tkinter.filedialog import askopenfilename, asksaveasfilename
ews = 3
xds = True
while xds:
password = input("ENTER A 7 DIGIT PASSWORD: ")
if password == "encrypt":
xds = False
def…
-1
votes
1 answer
char to integer value conversion (ord sometimes returns array)
is there a function to convert any character to a integer, and then back?
I tried using ord($string) and chr($int), however ord() sometimes returns an array for unusual letters from other languages, such as for "Ü" "Ä" and "Ö" from the german…

batscs
- 1
- 1
-1
votes
1 answer
Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
I have a problem with an old plugin installed on my Wordpress site. Since I updated my php to php 7.4, I am getting the message saying: "Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr()…

Enrico Trevisan
- 7
- 5
-1
votes
1 answer
Reversing a string while using user input for range and mirroring string without using builin functions in python
I have been stuck with this little problem on how to use the user input for "stop" in the range function and then mirror the string ( in this case the alphabet) back without getting double user input.
Plus now the code can only take a number but it…

MalcolmXYZ
- 126
- 8
-1
votes
2 answers
multiple input numbers for chr()
Im trying to enter multiple numbers such as
[106, 103, 110, 110, 113, 32, 121, 113, 116, 110, 102]
into the decryption using the ord(), then enter it through the caeser cipher. The caeser cipher works, but I dont know how to make work the chr(),…

悪魔 王
- 3
- 2
-1
votes
1 answer
I have a problem when i try to use chr python 3
I'm using vs code, and when i try to run this:
print(str(chr(257)))
I get this error:ValueError: chr() arg not in range(256)

Itamar Shubin
- 66
- 7
-1
votes
1 answer
Python 3 - incorrect decoding ascii symbols (Python 2.7 works well)
Via HTTP API I get array of integers, [37,80,68,70,45] - and so on, which represents ascii codes. I need to save it as pdf file. In php code is:
$data = file_get_contents($url);
$pdf_data = implode('', array_map('chr',…

Mihail
- 73
- 7
-1
votes
1 answer
why doesn't exec(chr(8)) delete a character from the shell?
I know this won't work, and it'll produce an error, but I'll ask it anyways.
exec(chr(8)) doesn't delete a character from the shell...
chr(8) is backspace in ascii. So naturally, I'd think it'll delete a character from the shell, like
>>>…

CoderBoy
- 107
- 11
-1
votes
1 answer
How can I make a ASCII to string converter in python using: ''.join(chr(i) for i in templist)
I'm trying to make an ASCII to string converter (not sure if that is correct terminology) using chr() but when I type in something like 68 (capital D), nothing happens. I'm trying to accomplish it using this idea:
>>> L = [104, 101, 108, 108, 111,…

DarkWolf009
- 9
- 4
-1
votes
3 answers
Load single-column CSV as value in R
I would like to know how can I convert a single column CSV file (with header) in to a character list in R. I've tried loading it as a data.frame in RStudio and then using as.character but the software gives me a string with random comma separated…

John
- 353
- 1
- 5
- 16
-1
votes
1 answer
C# Equivalent to VB6 Chr(number)
I have this code:
Dim sCenter As String
sCenter = Chr(27) + Chr(97) + Chr(1)
And I'm trying to convert to a C# code. Online converters always fail to convert... :(
So, what is the C# equivalente of Chr(number)?
Maybe Char.ConvertFromUtf32(10);

Nicke Manarin
- 3,026
- 4
- 37
- 79
-1
votes
2 answers
Printing the alphabet on one line python
How can I print the alphabet on one line using chr(), with each letter seperated by a space.
My current code:
for x in range(97,123):
letter = chr(x)
alphabet = "" + letter
print alphabet

user2989433
- 53
- 1
- 6