Anshu Kumar wrote:
> Hello All,
>
> So much Thanks for your response.
>
> Here is my actual scenario. I have a csv file and it would already be
> present. I need to read and remove some rows based on some logic. I have
> written earlier two separate file opens which I think was nice and clean.
>
On 19/01/16 05:41, Anshu Kumar wrote:
> Here is my actual scenario. I have a csv file and it would already be
> present. I need to read and remove some rows based on some logic. I have
> written earlier two separate file opens which I think was nice and clean.
Yes, it looks straightforward. The o
Hello All,
So much Thanks for your response.
Here is my actual scenario. I have a csv file and it would already be
present. I need to read and remove some rows based on some logic. I have
written earlier two separate file opens which I think was nice and clean.
actual code:
with open(file_path,
On Mon, Jan 18, 2016 at 10:04 PM, Martin A. Brown wrote:
> The above is a very handy chart. Did you find this somewhere, eryk
> sun, or is this from your own knowledge and experience?
The mapping to POSIX open flags is from a table in the POSIX fopen
spec [1] as well as the Windows CRT docs for
On 18Jan2016 20:41, Martin A. Brown wrote:
Yes and so have I. Maybe twice in 30 years of programming. [...]
I may have done it a little more than that; I agree it is very
rare. I may be biased because I was debugging exactly this last
week. (Which itself is an argument against mixed rerad/writ
Hi all,
The + modes are deceptively appealing but they are full of dangers
for precisely the reasons you have discovered(*).
>
>> Yes and so have I. Maybe twice in 30 years of programming. It's
>> sometimes necessary but it's much, much harder to get right and
>> very easy to get wron
Hello,
>> I have read in documentation that wb+ mode is for writing and
>> reading. Am i using wrong mode, should i use rb+ ?
>
>Use w+ to create a new file, opened with read and write access. Use
>r+ to open an existing file with read and write access. Unlike w+,
>r+ does not truncate the fil
On 18Jan2016 22:29, Peter Otten <__pete...@web.de> wrote:
Anshu Kumar wrote:
I have read in documentation that wb+ mode is for writing and reading. Am
i using wrong mode, should i use rb+ ?
Quoting https://docs.python.org/2.7/library/functions.html#open
"""
note that 'w+' truncates the file.
"
On 18Jan2016 21:07, ALAN GAULD wrote:
On 18/01/16 20:43, Cameron Simpson wrote:
The + modes are deceptively appealing but they are full of dangers
for precisely the reasons you have discovered(*). You very rarely
need them and you are better opening/closing the file and
using explicit modes to
On Mon, Jan 18, 2016 at 10:01 AM, Anshu Kumar wrote:
> I have read in documentation that wb+ mode is for writing and reading. Am i
> using wrong mode, should i use rb+ ?
Use w+ to create a new file, opened with read and write access. Use r+
to open an existing file with read and write access. Unl
Anshu Kumar wrote:
> Hello Everyone,
>
> I try below code in python 2.7.10 to first create and write into a file
> and
> then read and write that file but what i get is just a file with new
> content.
>
>
with open('test.txt', 'wb+') as f:
> ... f.write('this is test file.')
> ...
On 18/01/16 20:43, Cameron Simpson wrote:
>> The + modes are deceptively appealing but they are full of dangers
>> for precisely the reasons you have discovered(*). You very rarely
>> need them and you are better opening/closing the file and
>> using explicit modes to read/write.
>
> But if he wa
On 18Jan2016 16:29, ALAN GAULD wrote:
On 18/01/16 16:01, Anshu Kumar wrote:
I try below code in python 2.7.10 to first create and write into a file and
then read and write that file but what i get is just a file with new
content.
with open('test.txt', 'wb+') as f:
... f.write('this is
On 18/01/16 16:01, Anshu Kumar wrote:
> Hello Everyone,
>
> I try below code in python 2.7.10 to first create and write into a file and
> then read and write that file but what i get is just a file with new
> content.
>
>
with open('test.txt', 'wb+') as f:
> ... f.write('this is test f
Hello Everyone,
I try below code in python 2.7.10 to first create and write into a file and
then read and write that file but what i get is just a file with new
content.
>>> with open('test.txt', 'wb+') as f:
... f.write('this is test file.')
... f.write('ok!!!')
...
>>> with open('test
15 matches
Mail list logo