Chris Angelico wrote:
> On Sat, Apr 18, 2015 at 12:26 AM, wrote:
>> I tried to do as follows,
> import codecs
> sourceEncoding = "iso-8859-1"
> targetEncoding = "utf-8"
> source = open("source1","w")
> string1="String type"
> str1=str(string1)
> source.write(str1)
>>>
On 04/17/2015 10:48 AM, Dave Angel wrote:
On 04/17/2015 09:19 AM, subhabrata.bane...@gmail.com wrote:
>>> target = open("target", "w")
It's not usually a good idea to use the same variable for both the file
name and the opened file object. What if you need later to print the
name, as in
Chris Angelico :
> Here's how I'd do it.
>
> $ python3
with open("source1", encoding="iso-8859-1") as source,
>> open("target", "w", encoding="utf-8") as target:
> ... target.write(source.read())
You might run out of memory. How about:
===
On 04/17/2015 09:19 AM, subhabrata.bane...@gmail.com wrote:
I am having few files in default encoding. I wanted to change their encodings,
preferably in "UTF-8", or may be from one encoding to any other encoding.
You neglected to specify what Python version this is for. Other
information tha
On Sat, Apr 18, 2015 at 12:26 AM, wrote:
> I tried to do as follows,
import codecs
sourceEncoding = "iso-8859-1"
targetEncoding = "utf-8"
source = open("source1","w")
string1="String type"
str1=str(string1)
source.write(str1)
source.close()
target = op
On Friday, April 17, 2015 at 7:36:46 PM UTC+5:30, Oscar Benjamin wrote:
> wrote:
> > On Friday, April 17, 2015 at 6:50:08 PM UTC+5:30, wrote:
> >> I am having few files in default encoding. I wanted to change their
> >> encodings,
> >> preferably in "UTF-8", or may be from one encoding to any ot
On 17 April 2015 at 14:51, wrote:
> On Friday, April 17, 2015 at 6:50:08 PM UTC+5:30, subhabrat...@gmail.com
> wrote:
>> I am having few files in default encoding. I wanted to change their
>> encodings,
>> preferably in "UTF-8", or may be from one encoding to any other encoding.
>>
>> I was try
On Friday, April 17, 2015 at 6:50:08 PM UTC+5:30, subhabrat...@gmail.com wrote:
> I am having few files in default encoding. I wanted to change their
> encodings,
> preferably in "UTF-8", or may be from one encoding to any other encoding.
>
> I was trying it as follows,
>
>>>> import codec
On Friday, April 17, 2015 at 6:50:08 PM UTC+5:30, subhabrat...@gmail.com wrote:
> I am having few files in default encoding. I wanted to change their
> encodings,
> preferably in "UTF-8", or may be from one encoding to any other encoding.
>
> I was trying it as follows,
>
>>>> import codec
I am having few files in default encoding. I wanted to change their encodings,
preferably in "UTF-8", or may be from one encoding to any other encoding.
I was trying it as follows,
>>> import codecs
>>> sourceEncoding = "iso-8859-1"
>>> targetEncoding = "utf-8"
>>> source = open("so
10 matches
Mail list logo