Look at the following line:
E|1256280||2014-01-05 17:54:00|1|2014-01-05 18:59:53|True
I would like to smash it by. pipe symbol "|". Therefore, I use the following python code (where the string is the string containing the string described above):
print line
print str(type(line))
print str(line[1])
parts = line.split['|']
print str(parts)
However, when using this part of the code, I get the following error:
E|1256280||2014-01-05 17:54:00|1|2014-01-05 18:59:53|True
<type 'str'>
|
Traceback (most recent call last):
File "/path/to/my/pythonscritp.py", line 34, in crawl_live_quotes
parts = line.split['|']
TypeError: 'builtin_function_or_method' object is not subscriptable
However, I do not understand what I am doing wrong here. Any suggestions?
source
share