• Register
1 vote
26 views

Problem:

Can anyone tell me how to get ascii value of char in python. I am newbee so please help.

10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

1 vote

Answer:

To get ascii value of char in python you can use the code.(Here I did this for the char x)

a = 'x'
print("Your value in ascii'" + a + "' is", ord(a))

And our output will be:

Your value in ascii'x' is 120

you can use this code for any other char to get their ascii values. Happy coding.

11 6 4
34,950 points

Related questions

0 votes
1 answer 51 views
51 views
I need to write a program where I input a character and get Ascii value.
asked Oct 8, 2020 Ahsan 1.8k points
0 votes
1 answer 6 views
6 views
Problem: I'm using Python Pyramid with Jinja2 template. I want to save my form data into session and retrieve it in another HTML page. How should I change in order to pass the data? I only know how to store the data I key in Views.py into session like this request.session[' ... command prompt but not HTML page. Can anyone help me out? I'm a beginner to this. What to add in/ change in my Views.py?
asked Jan 6 Mashhoodch 9.6k points
0 votes
1 answer 51 views
51 views
Hello house, I would like to know how to solve this Python SyntaxError: Non-ASCII character '\xe2' in file. Thanks
asked Oct 23, 2020 psandprop 2.4k points
0 votes
1 answer 17 views
17 views
Problem: I want to know how can I get the ascii value of character in C++? Is there any mechanism to do so? If yes, then please elaborate with examples.
asked Oct 21, 2020 Code Learner 6k points
0 votes
1 answer 28 views
28 views
Hello kodlogs, I am a newbie in python just started learning while learning or implemented my logic for the printing a string of the element from the string but while accessing the last element I have to check every time that the index to element and it is time-consuming is there another way to get or access the element with no extra overhead?
asked Jun 8, 2020 Gavin 15.3k points
0 votes
1 answer 28 views
28 views
Problem: Hello kodlogs, Recently while attempting, the problem in the python there is a error that came can you please help sort out this problem, How can I get the first character from the first string in Python?,It seems that I could use list[0][1:] but that does not give me the first character of the string that I am looking for. mysrt = "sdf" >>> mystr[0][1:]
asked Jun 6, 2020 Gavin 15.3k points
1 vote
1 answer 25 views
25 views
Problem: I have a python file that contains too many lines of code. I have written a code to count the total number of lines in a exact file. My code: def file_name(fname): with open(fname) as fn: for i, l in enumerate(fn): pass return i+1 Does the code give me the exact count ? If not how can I solve this?
asked Apr 5, 2020 LizzyM 6.1k points
1 vote
1 answer 17 views
17 views
Problem: Well, I have a text file containing thousands of lines possibly. I am willing to give them a count (if possible). What is the easiest and efficient way to write a program to get number of lines in a file python? Please, keep it simple so that I can understand the code easily. Thanks.
asked Mar 29, 2020 Gavin 15.3k points
0 votes
1 answer 49 views
49 views
The Python documentation seems unclear about whether parameters are passed by reference or value, and the following code produces the unchanged value 'Original' class PassByReference: def __init__(self): self.variable = 'Original' self.change(self.variable) print(self.variable) def change(self, var): var = 'Changed' Is there something I can do to pass the variable by actual reference?
asked Oct 25, 2020 psandprop 2.4k points
1 vote
1 answer 22 views
22 views
Problem: I have a dictionary that consists of: Dict = {     "Krishna" : 79,     "Arnav" : 46,     "Paulo" : 90,     "Christian" : 77,     "Renartovic" : 33,     "Wanda" : 65,     "Arteta" : 80,     "Santiago" : 68,     "Jovic" : 88     } I ... compiling this program:   File "val.py", line 13     if "Wanda" in Dict:     ^ IndentationError: unexpected indent Can anyone help me to solve this error?
asked Jun 7, 2020 samhaz 5k points