Ayyyy, I need some help. I have the following strings, always in "char,num" format:
s = "abcdef,12"
v = "gbhjjj,699"
split is superior because it is very clear and fast:
>>> s = "abcdef,12" >>> s.split(',') '12'
Another way is with
>>> s = "abcdef,12" >>> s[s.find(',')+1:] '12'
And another way with
>>> import re >>> s = "abcdef,12" >>> re.search(r',(.*)', s).group(1) '12'
io so I don't have to write a file to the hard drive):
>>> import csv >>> import io >>> s = "abcdef,12" >>> r = csv.reader(i) >>> for line in r: ... print(line) ... 12
I'm sure there are other ways to accomplish this task. This is just a small sample.