小编use*_*551的帖子

如何在一行line-python中打印出一个字符串和列表

a=[1,2,3]
print "the list is ?%"%(a)
Run Code Online (Sandbox Code Playgroud)

我想打印出这样一行:the list is?[1,2,3] 我不能在一行内完成,我必须这样做:

print " the list is :%"
print a
Run Code Online (Sandbox Code Playgroud)

我想知道我是否可以打印出与字符串格式和一行列表相结合的内容.

python formatting

5
推荐指数
3
解决办法
2万
查看次数

python 地图功能不起作用

这是我在编辑器上编辑并在 shell 上编译的代码。
如果我输入整数19,当我打印出c时,它仍然['1','9']不是[1,9]我想要的。我在交互式解释器上尝试了这个,而不是编译 python 文件,它起作用了。

a = raw_input("Please enter a positive number ")    
c = []    
c = list(a)    
map(int, c) 
Run Code Online (Sandbox Code Playgroud)

python list python-2.7 map-function

-2
推荐指数
1
解决办法
1510
查看次数

标签 统计

python ×2

formatting ×1

list ×1

map-function ×1

python-2.7 ×1