1·Centos上安装python3.8
#!/bin/bash
# install python3.8
mkdir /usr/local/python3
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
# download python
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
# unzip
tar -zxvf Python-3.8.0.tgz
cd Python-3.8.0
# install
./configure -prefix=/usr/local/python3
sudo make && make install
# make links
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
查找文本中以固定字符結尾的單詞
# _*_coding:utf-8_*_
import string
f = open("./metadata.txt", "r" ,encoding="UTF-8")
line = f.readline()
trantab = str.maketrans({key: None for key in string.punctuation})
words = set()
while line:
words = words.union(set(line.split('|')[2].strip('\n').strip(string.digits).translate(trantab).split()))
line = f.readline()
f.close()
for word in words:
if word.endswith("z"):
print(word)
eSpeak 编译时遇到的错误
g++ -O2 -DUSE_PORTAUDIO -D PATH_ESPEAK_DATA="/usr/share/espeak-data" -Wall -pedantic -I. -c -fno-exceptions speak.cpp
make: g++: Command not found
make: *** [speak.o] Error 127
yum -y install gcc+ gcc-c++