日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Python 程序:查找字符串中所有字符的 ASCII 值

創(chuàng)新互聯(lián)python教程:

寫一個(gè) Python 程序,用一個(gè)實(shí)際的例子找到字符串中總字符的 ASCII 值。

Python 程序查找字符串中總字符的 ASCII 值示例 1

這個(gè) python 程序允許用戶輸入一個(gè)字符串。接下來,它使用 For 循環(huán)打印該字符串中的字符。這里,我們使用 For 循環(huán)來迭代字符串中的每個(gè)字符。在 For 循環(huán)中,我們使用 print 函數(shù)返回該字符串中所有字符的 ASCII 值。

提示:請參考 String 文章了解 String 的一切。也可以參考 Python 中的 ASCII 表一文來理解 ASCII 值。

# Python program to find ASCII Values of Total Characters in a String

str1 = input("Please Enter your Own String : ")

for i in range(len(str1)):
    print("The ASCII Value of Character %c = %d" %(str1[i], ord(str1[i])))

Python 程序獲取字符串中的字符總數(shù)的 ASCII 值示例 2

這個(gè) ASCII 值 python 程序同上。然而,我們只是將換成了同時(shí)換成了。

# Python program to find ASCII Values of Total Characters in a String

str1 = input("Please Enter your Own String : ")
i = 0

while(i < len(str1)):
    print("The ASCII Value of Character %c = %d" %(str1[i], ord(str1[i])))
    i = i + 1

Python 字符串 ASCII 值輸出

Please Enter your Own String : Hello
The ASCII Value of Character H = 72
The ASCII Value of Character e = 101
The ASCII Value of Character l = 108
The ASCII Value of Character l = 108
The ASCII Value of Character o = 111

網(wǎng)頁標(biāo)題:Python 程序:查找字符串中所有字符的 ASCII 值
網(wǎng)址分享:http://m.5511xx.com/article/cciodso.html