delimiting carat A in python

半腔热情 提交于 2019-12-02 02:25:22

If the original data uses a control-A as a delimiter, and it's just being printed as ^A in whatever you're using to list the data, you have two choices:

  1. Pipe whatever you use the list the data into a Python script that uses split('^A').

  2. Just use split('\u001') to split on actual control-A values.

The latter is almost always going to be what you really want. The reason this didn't work from you is that you wrote split('\\u001'), escaping the backslash, so you're splitting on the literal string \u001 rather than on control-A.

If the original data actually has ^A (a caret followed by an A) as the delimiter, just use split('^A').

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!