Python使用笔记

目录

1 python中字节与字符串的转换

2 Python3下提示No module named 'tkinter'"问题解决

3 提示没有pip命令

4 问题WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.



python中字节与字符串的转换

#bytes object
byte = b"byte example"

# str object
str = "str example"

# str to bytes 字符串转字节
bytes(str, encoding="utf8")

# bytes to str  字节转字符串
str(byte, encoding="utf-8")

# an alternative method
# str to byte  字符串转为字节
str.encode(str)

# bytes to str  字节转为字符串
bytes.decode(byte)

2 Python3下提示No module named 'tkinter'问题解决

sudo apt search python3-tk

 

3 提示没有pip命令

https://www.liumingye.cn/archives/250.html

 

4 问题WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.


python -m pip install torchtext(包名)# python -m 会指定你当前使用的python版本

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值