Amrita, on a closer read of your very first post I (think I) see you
already successfully read your data into a series of dicts (mylist in your
example), so if you still want the output you posted in the first post,
then you can do some version of the loops that I described. That said, I'm
sure Ste
On Sun, Jan 5, 2014 at 5:26 PM, Steven D'Aprano wrote:
> On Sun, Jan 05, 2014 at 11:02:34AM -0500, eryksun wrote:
>>
>>
>
> That surprises me. I thought XML was only valid in UTF-8? Or maybe that
> was wishful thinking.
JSON text SHALL be encoded in Unicode:
https://tools.ietf.org/html/rfc4
On 2014-01-05 14:26, Steven D'Aprano wrote:
On Sun, Jan 05, 2014 at 11:02:34AM -0500, eryksun wrote:
Danny walked you through the XML. Note that he didn't decode the
response. It includes an encoding on the first line:
That surprises me. I thought XML was only valid in UTF-8? Or maybe t
Hi Amrita,
On Sun, Jan 05, 2014 at 10:01:16AM +0800, Amrita Kumari wrote:
> I have saved my data in csv format now it is looking like this:
If you have a file in CSV format, you should use the csv module to read
the file.
http://docs.python.org/3/library/csv.html
If you're still using Python
On Sun, Jan 05, 2014 at 11:02:34AM -0500, eryksun wrote:
> Danny walked you through the XML. Note that he didn't decode the
> response. It includes an encoding on the first line:
>
>
That surprises me. I thought XML was only valid in UTF-8? Or maybe that
was wishful thinking.
> tr
I should have included an example. If you can, and if it doesn't make your
file too long, and if I'm right that this is easy to do in the output
module of wherever this is coming from, add some white space so you can
read/debug easier, though it's not at all necessary (strings have to be
quoted als
On 2014-01-05 08:02, eryksun wrote:
On Sun, Jan 5, 2014 at 2:57 AM, Alex Kleider
wrote:
def ip_info(ip_address):
response = urllib2.urlopen(url_format_str %\
(ip_address, ))
encoding = response.headers.getparam('charset')
print "'encoding' is '%s
Hi Amrita, I'm just a beginner but I notice that, after the first two
entries on each line (i.e. 10,ALA), the rest might fit nicely into a dict,
like this {H: 8.388, HB1: 1.389, ...}. That would give you a lot of
flexibility in getting at the values later. It would be easy enough to
replace the "="
On Sun, Jan 5, 2014 at 2:52 AM, Mark Lawrence wrote:
> Homework for you :) Write a line of code that creates a list of say 3 or
> 4 integers, then write a line that creates a tuple with the same integers.
> Use the dis module to compare the byte code that the two lines of code
> produce. The di
On Sun, Jan 5, 2014 at 2:57 AM, Alex Kleider wrote:
> def ip_info(ip_address):
>
> response = urllib2.urlopen(url_format_str %\
>(ip_address, ))
> encoding = response.headers.getparam('charset')
> print "'encoding' is '%s'." % (encoding, )
> inf
Hi,
> OSError: [Errno 2] No such file or directory: 'alfresco20140104-.sql'
> I get results if I do it without giving the dir location such as
That is because the getctime call will run based in the current working
directory. You can use a construct like:
max([os.path.join('opt', 'foo', x
Hi All,
Even though I am a old user in the mailing list, my skills in Python are
not impressive.
I have restarted doing python for some small task.
I am trying to find the latest file in a dir, I have searched and found out
I shoulld do in this way
#!/usr/bin/python
import os
newe
On Sat, Jan 04, 2014 at 11:57:20PM -0800, Alex Kleider wrote:
> Well, I've tried the xml approach which seems promising but still I get
> an encoding related error.
> Is there a bug in the xml.etree module (not very likely, me thinks) or
> am I doing something wrong?
I'm no expert on XML, but i
On 05/01/2014 02:31, Alex Kleider wrote:
I've been maintaining both a Python3 and a Python2.7 version. The
latter has actually opened my eyes to more complexities. Specifically
the need to use unicode strings rather than Python2.7's default ascii.
This might help http://python-future.org/
-
On 01/05/2014 08:57 AM, Alex Kleider wrote:
On 2014-01-04 21:20, Danny Yoo wrote:
Oh! That's unfortunate! That looks like a bug on the hostip.info
side. Check with them about it.
I can't get the source code to whatever is implementing the JSON
response, so I can not say why the city is not
On 01/05/2014 03:31 AM, Alex Kleider wrote:
I've been maintaining both a Python3 and a Python2.7 version. The latter has
actually opened my eyes to more complexities. Specifically the need to use
unicode strings rather than Python2.7's default ascii.
So-called Unicode strings are not the solut
On 01/04/2014 08:26 PM, Alex Kleider wrote:
Any suggestions as to a better way to handle the problem of encoding in the
following context would be appreciated. The problem arose because 'Bogota' is
spelt with an acute accent on the 'a'.
$ cat IP_info.py3
#!/usr/bin/env python3
# -*- coding : ut
On 01/05/2014 12:52 AM, Steven D'Aprano wrote:
If you don't understand an exception, you
have no business covering it up and hiding that it took place. Never use
a bare try...except, always catch the *smallest* number of specific
exception types that make sense. Better is to avoid catching except
Sorry I forgot to add tutor mailing list.please help for the below.
-- Forwarded message --
From: Amrita Kumari
Date: Fri, Jan 3, 2014 at 2:42 PM
Subject: Re: [Tutor] arrangement of datafile
To: Evans Anyokwu
Hi,
I have saved my data in csv format now it is looking like th
On 01/05/2014 08:52 AM, Mark Lawrence wrote:
On 05/01/2014 07:09, Keith Winston wrote:
Thanks all, interesting. I'll play more with tuples, I haven't knowingly
used them at all...
Keith
Homework for you :) Write a line of code that creates a list of say 3 or 4
integers, then write a line t
20 matches
Mail list logo