文件内容rolling.txt: There's a fire starting in my heart 我怒火中烧 Reaching a fever pitch and it's bringing me out the dark 熊熊烈焰带我走出黑暗 Finally, I can see you crystal clear 最终 我将你看得一清二楚 Go ahead and sell me out and I'll lay your ship bare 去吧 出卖我 我会让你一无全部 See
解决 python 读取文件乱码问题(UnicodeDecodeError) 确定你的文件的编码,下面的代码将以'utf-8'为例,否则会忽略编码错误导致输出乱码 解决方案一 with open(r'/Users/mac/Desktop/face/2.1.docx', 'rb', ) as fr: data = fr.read() line_list = data.decode('utf8').split('\n') data_l = [] for line in line_list: line
读取文件,每行拆分,并比较拆分数组长度 #!/bin/bash FILENAME=./.txt function While_read_LINE(){ cat $FILENAME | while read LINE do str=$LINE OLD_IFS="$IFS" IFS=";" arr=($str) IFS="$OLD_IFS" lineLen=${#arr[@]} minLen= if [ $lineLen -le $minLen ];