Skip to main content
 首页 » 编程设计

python之Python IO 流的大小

2025年05月04日19lidabo

import io 
string_out = io.StringIO() 
string_out.write("hello") 
print(string_out.lenght()) 

我想知道 string_out StringIO 的大小。 StringIO 中是否有支持此功能的方法?

请您参考如下方法:

write() 的返回值是写入的字符数。

import io 
string_out = io.StringIO() 
length = string_out.write("hello") 
print(length)