• Register
1 vote
23 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,050 points

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,930 points

Related questions

0 votes
1 answer 8 views
8 views
I need to write a program where I input a character and get Ascii value.
asked Oct 8 Ahsan 1.6k points
0 votes
1 answer 23 views
23 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 Gavin 15.3k points
0 votes
1 answer 19 views
19 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 Gavin 15.3k points
1 vote
1 answer 20 views
20 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 LizzyM 6.1k points
1 vote
1 answer 13 views
13 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 Gavin 15.3k points