When I print an array:
pi = [3,1,4,1,5,9,2,6,5] print pi
It prints as usual:
[3, 1, 4, 1, 5, 9, 2, 6, 5]
I was wondering if it is possible to print as:
314159265
If so, how?
You can use str.join:
str.join
>>> pi = [3,1,4,1,5,9,2,6,5] >>> print ''.join(map(str, pi)) 314159265
Or print:
print
>>> from __future__ import print_function #not required in Python 3 >>> print(*pi, sep='') 314159265
Source: https://habr.com/ru/post/1531823/More articles:error: iostream.h due to the inclusion of cplex - c ++Python multiprocessing.Pool map () "TypeError: string indices must be integers, not str" - pythonRegex: сопоставление определенных символов в любом порядке без появления вхождения каждого символа, чем указано - regexGoogle Map Polygon with a hole didn’t do well if the zoom level is greater than 19 - androidIs it possible to explicitly specify template arguments for the operator? - c ++Grails - JNDI app on Tomcat Vs Weblogic - javaHow to specify jndi datsource porting to grails - tomcatHow to install ReviewBoard under Nginx? - pythonblockchain getjson javascript XMLHttpRequest - javascriptPython: assigning class attributes to boolean / flag - pythonAll Articles