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?
Forum Archive
Can’t use split(‘\t’) on inputs separated by tabs
Simplemathic
Oct 11, 2020 - 14:57
cvp
Oct 11, 2020 - 17:20
@Simplemathic for me, running this line of code prints True
print('a b' == 'a\tb')
I've typed a tab between a and b

mikael
Oct 11, 2020 - 17:59
@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)
Simplemathic
Oct 11, 2020 - 18:42
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!
GxAl2aa
Oct 12, 2020 - 06:26
```
bolded text```
Anderson_Vian
Oct 14, 2020 - 10:36
I was looking for the same info, tried doing the same but it didn't worked!
NelsonPalmer
Nov 06, 2020 - 06:58
Effective and interesting post for reading WalgreensListens