I have a Python script gathering info from some remote network devices. The output can be maybe 20 to 1000 lines of text. This then goes into excel on my local PC for now.
Now access to this Linux device is convoluted, a citrix session to a remote windows server then ssh to the Linux device half way around the world. There is no ftp, scp, or anything like that, so I can't generate the excel on the Linux device and transfer it locally. The ONLY way to get the info is to copy/开发者_JS百科paste from the ssh window into the local machine and post-process it
My question is what would be the best (from a user point of view as others will be using it) format to generate? 1.as it is now (spaces & tabs), 2.reformat as csv or as 3.convert to xml
CSV is more robust than your current format under "copy and paste transfer" -- spaces and tabs can easily get confused, commas and doublequotes aren't. And the Python standard library's csv module makes it pretty easy to solidly generate good CSV output.
Reformat it as CSV. It's dead easy to do, is fairly human readable, and can be read by loads of pieces of spreadsheet software.
Are you sure copy-paste is the only way? If you can interactively ssh to the Linux device, then you can also ssh plus run a command plus redirect the output. So:
ssh remote-linux-box command-to-run >output-file
This doesn't involve any manual copy and paste at all.
精彩评论