Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Can’t use split(‘\t’) on inputs separated by tabs
-
I have to write a program that expects numbers separated by tabs (‘\t’) as its input. I tried to Create an input like this in Pythonista using the tab (upper left button) but that was not recognized as ‘\t’. (The split() function was unable to detect tabs as ‘\t’) How could I create this type of input?
-
@Simplemathic for me, running this line of code prints True
print('a b' == 'a\tb')
I've typed a tab between a and b
-
@Simplemathic, you might have some other problem, or I am misunderstanding your issue. This works as expected when given numbers separated by the Pythonista tab key:
input_str = input('Numbers separated by tabs: ') for n in input_str.split(): print(n)
-
So my original problem was that splitting an input separated by tabs using split(‘\t’) did not split the string up. However, as mikael pointed it out, using split() - leaving it empty - works! Thank you for the answers!
-
This post is deleted! -
This post is deleted! -
This post is deleted!