0

I want to strip platform.linux_distribution().

Output is tuple ('Ubuntu', '11.10', 'oneiric') but I want to show it as "Ubuntu 11.10 oneriric"

.group(1) is not working.

sarnold
  • 102,305
  • 22
  • 181
  • 238
  • Not clear on the question. Are you trying to just format a tuple into a string? – Joe Oct 26 '11 at 23:56

3 Answers3

4

You're looking for " ".join():

>>> import platform
>>> platform.linux_distribution()
('Ubuntu', '11.04', 'natty')
>>> " ".join(platform.linux_distribution())
'Ubuntu 11.04 natty'
>>> 
sarnold
  • 102,305
  • 22
  • 181
  • 238
0

How about this:

" ".join(platform.linux_distribution())
Brendan Long
  • 53,280
  • 21
  • 146
  • 188
0

how about:

' '.join(platform.linux_distribution())

I'm on a mac, so I don't have platform.linux_distribution(), but it looks like it should return an array.

ObscureRobot
  • 7,306
  • 2
  • 27
  • 36