#Python TQC考題802 字元對應
s=input()
sum=0
for i in range(len(s)):
print(“ASCII code for ‘%s’ is %d” %(s[i],ord(s[i])))
#右邊有))) 三個,也是會錯的地方
#先寫s[i],再用ord()包覆
#chr() 則是ord()的反向,把ASCII碼轉為字母
sum += ord(s[i])
print(sum)

#再練習一次:


#多使用了list(str)的技巧
#不能用[ str ],要 list(str)
#字串才會每個字母拆開進入list中

“””
string跟list一樣,
都可以使用index定位
其實沒有非要做 =list(string)
就是list比string常用
直覺會這麼做
“””

#覺得ord( str1[i] )太長的話,可以先令他等於ord1:

# for i in str1:
#跟list的用法一樣




![Python-docx 圖片提取完全指南:從 rId 到二進位資料的探險rid ; part = doc.part.rels[rid].target_part #return part.blob if “ImagePart” in type(part).__name__ else None Python-docx 圖片提取完全指南:從 rId 到二進位資料的探險rid ; part = doc.part.rels[rid].target_part #return part.blob if “ImagePart” in type(part).__name__ else None](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2026/01/20260113135812_0_8fa645.png?quality=90&zoom=2&ssl=1&resize=350%2C233)



![Python: 如何將folder_name, file_name合併為file_path? fpath = os.path .join(folder, fname) ; “\\”.join([folder, fname]) ; 如何將file_path拆分出folder? Python: 如何將folder_name, file_name合併為file_path? fpath = os.path .join(folder, fname) ; “\\”.join([folder, fname]) ; 如何將file_path拆分出folder?](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2023/03/20230330132954_84.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

![Python: pandas.DataFrame如何移除所有空白列?pandas.isna( df_raw[0] ).tolist() ; df_drop0 = df_raw.drop(nanIdx,axis=0).reset_index(drop=True) Python: pandas.DataFrame如何移除所有空白列?pandas.isna( df_raw[0] ).tolist() ; df_drop0 = df_raw.drop(nanIdx,axis=0).reset_index(drop=True)](https://i0.wp.com/savingking.com.tw/wp-content/uploads/2022/12/20221206184635_4.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

近期留言