On 7/5/17, Binary Boy wrote:
> On Wed, 05 Jul 2017 20:37:38 +0300, Jussi Piitulainen wrote:
>> Sam Chats writes:
>>
>> > On Wednesday, July 5, 2017 at 9:09:18 PM UTC+5:30, Grant Edwards wrote:
>> >> On 2017-07-05, Sam Chats wrote:
>> >>
>> >> > I want to
Binary Boy writes:
> On Wed, 05 Jul 2017 20:37:38 +0300, Jussi Piitulainen wrote:
>> Sam Chats writes:
>>
>> > On Wednesday, July 5, 2017 at 9:09:18 PM UTC+5:30, Grant Edwards wrote:
>> >> On 2017-07-05, Sam Chats wrote:
>> >>
>> >> > I want to write, say, 'hello\tworld'
On Wed, 05 Jul 2017 20:37:38 +0300, Jussi Piitulainen wrote:
> Sam Chats writes:
>
> > On Wednesday, July 5, 2017 at 9:09:18 PM UTC+5:30, Grant Edwards wrote:
> >> On 2017-07-05, Sam Chats wrote:
> >>
> >> > I want to write, say, 'hello\tworld' as-is to a file, but doing
> >>
Sam Chats writes:
> On Wednesday, July 5, 2017 at 9:09:18 PM UTC+5:30, Grant Edwards wrote:
>> On 2017-07-05, Sam Chats 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
On Wednesday, July 5, 2017 at 9:09:18 PM UTC+5:30, Grant Edwards wrote:
> On 2017-07-05, Sam Chats 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
On 2017-07-05, Sam Chats 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?
On 2017-07-05 17:09, Sam Chats wrote:
>
> Thanks, but I've tried something similar. Actually, I want to convert a
> string which I receive from a NNTP server to a raw string. So if I try
> something like:
> raw = r"%s" % string_from_server
>
You may me looking for repr()
On Wednesday, July 5, 2017 at 8:22:13 PM UTC+5:30, Stephen Tucker wrote:
> Sam,
>
> You use
>
> f.write(r'hello\tworld')
>
> The r in front of the string stands for raw and is intended to switch off
> the escape function of the backslash in the string. It works fine so long
> as the string
Sam,
You use
f.write(r'hello\tworld')
The r in front of the string stands for raw and is intended to switch off
the escape function of the backslash in the string. It works fine so long
as the string doesn't end with a backslash, as in
f.write('hello\tworld\')
If you try this, you get an
Sam,
You use
r'hello\tworld'
The r in front of the string stands for raw and it is intended to switch
off the normal escape function of a backslash. It works fine so long as the
string doesn't end with a backslash. If you end the string with a
backslash, as in
r'hello\tworld\'
you get an
I want to write, say, 'hello\tworld' as-is to a file, but doing
f.write('hello\tworld') makes the file
look like:
hello world
How can I fix this? Thanks in advance.
Sam
--
https://mail.python.org/mailman/listinfo/python-list
11 matches
Mail list logo