python字符串垂直输出 python字符串垂直输出?

python字符串垂直输出?在Python 3下运行def test(a):对于a中的B:print(B)a=“this is a string”输出效果如图所示B=“Chinese and Engl

python字符串垂直输出?

在Python 3下运行

def test(a):

对于a中的B:

print(B)

a=“this is a string”

输出效果如图所示

B=“Chinese and English string”

输出效果如图所示

s=read(“string”

STR=read(“substring:”)

python编程字符串垂直输出?

实现方法有两种:首先,先声明变量,然后进行转换;其次,先反向使用列表变量,然后将变量名存储在列表字符串中,最后使用locale映射变量并为变量赋值。参考一个简单的例子,代码如下:VAR=123445 s=locales()[“VAR”]S2=vars()[“VAR”]print s,S2

def test(a):对于a中的B:print(B)a=“this is a string”输出效果如图B=“Chinese and English string”输出效果如图B所示