On Wednesday, July 5, 2017 at 9:09:18 PM UTC+5:30, Grant Edwards wrote: > On 2017-07-05, Sam Chats <blahb...@blah.org> wrote: > > > I want to write, say, 'hello\tworld' as-is to a file, but doing > > f.write('hello\tworld') makes the file look like: > [...] > > How can I fix this? > > That depends on what you mean by "as-is". > > Seriously. > > Do you want the single quotes in the file? Do you want the backslash > and 't' character in the file? > > When you post a question like this it helps immensely to provide an > example of the output you desire. > > -- > Grant Edwards grant.b.edwards Yow! Is it 1974? What's > at for SUPPER? Can I spend > gmail.com my COLLEGE FUND in one > wild afternoon??
I would add to add the following couple lines to a file: for i in range(5): print('Hello\tWorld') Consider the leading whitespace to be a tab. Thanks, Saurabh -- https://mail.python.org/mailman/listinfo/python-list