From: Krishnamoorthy, M. <Mut...@fi...> - 2008-06-04 19:51:45
|
According to documentation, the method splitlines() tokenizes a string based on newline character(s). I tried this with the following string (this string may look strange, but it has significance in IBM WebSphere, and I tried it as part of a WebSphere administration script I was putting together): My string variable nodes: wsadmin>nodes 'adawa302BHN(cells/bhn/nodes/adawa302BHN|node.xml#Node_1)\nadawa302BHNDm gr(cells/bhn/nodes/adawa302BHNDmgr|node.xml#Node_1)\nadawa303BHN(cells/b hn/nodes/adawa303BHN|node.xml#Node_1)' The method split() works correctly when I use newline character as separator: wsadmin>nodes.split('\n') ['adawa302BHN(cells/bhn/nodes/adawa302BHN|node.xml#Node_1)', 'adawa302BHNDmgr(cells/bhn/nodes/adawa302BHNDmgr|node.xml#Node_1)', 'adawa303BHN(cells/bhn/nodes/adawa303BHN|node.xml#Node_1)'] The method splitlines() does not produce the same list output as split('\n') does: wsadmin>nodes.splitlines() ['adawa', '', '', '', '', '', '', 'cells', 'bhn', 'nodes', 'adawa', '', '', '', '', '', '', 'node', 'xml', '', 'ode', '', '', '', 'adawa', '', '', '', '', '', '', 'mgr', 'cells', 'bhn', 'nodes', 'adawa', '', '', '', '', '', '', 'mgr', 'node', 'xml', '', 'ode', '', '', '', 'adawa', '', '', '', '', '', '', 'cells', 'bhn', 'nodes', 'adawa', '', '', '', '', '', '', 'node', 'xml', '', 'ode', '', ''] Thanks for any help... Muthuswamy Email Confidentiality Notice: The information contained in this transmission is confidential, proprietary or privileged and may be subject to protection under the law, including the Health Insurance Portability and Accountability Act (HIPAA). The message is intended for the sole use of the individual or entity to whom it is addressed. If you are not the intended recipient, you are notified that any use, distribution or copying of the message is strictly prohibited and may subject you to criminal or civil penalties. If you received this transmission in error, please contact the sender immediately by replying to this email and delete the material from any computer. |