python 脚本----学习笔记

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++
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值