小编Sha*_*hai的帖子

在python中从字符串中打印一个单词

如何在python中只打印字符串中的某些单词?假设我想只打印第3个单词(这是一个数字)和第10个单词

而每次文本长度可能不同

mystring = "You have 15 new messages and the size is 32000"

谢谢.

python printing string split

4
推荐指数
1
解决办法
2万
查看次数

Python - 从文件中打印十六进制

我有以下代码:

code1 = ("\xd9\xf6\xd9\x74\x24\xf4\x5f\x29\xc9\xbd\x69\xd1\xbb\x18\xb1")
print code1

code2 = open("code.txt", 'rb').read()
print code2
Run Code Online (Sandbox Code Playgroud)

code1输出:

???t$?_)?½i?»±
Run Code Online (Sandbox Code Playgroud)

code2输出:

"\xd9\xf6\xd9\x74\x24\xf4\x5f\x29\xc9\xbd\x69\xd1\xbb\x18\xb1"
Run Code Online (Sandbox Code Playgroud)

我需要code2(我从文件中读取)与code1具有相同的输出.
我怎么解决这个问题?

python printing hex file

1
推荐指数
1
解决办法
1995
查看次数

标签 统计

printing ×2

python ×2

file ×1

hex ×1

split ×1

string ×1