John Machin wrote:
Mike Driscoll wrote:
Well you could always do something like this:
output = ';'.join(roadList)
Which will put single quotes on the ends.
No, it doesn't. You are conflating foo and repr(foo).
I suppose if you want to be
silly, you could do this:
output = '"%s"' % ';'.j
Mike Driscoll wrote:
Well you could always do something like this:
output = ';'.join(roadList)
Which will put single quotes on the ends.
No, it doesn't. You are conflating foo and repr(foo).
I suppose if you want to be
silly, you could do this:
output = '"%s"' % ';'.join(roadList)
*IF*
Joe Riopel wrote:
On Tue, Apr 22, 2008 at 4:55 PM, DataSmash <[EMAIL PROTECTED]> wrote:
Hello,
I have a list that looks like this:
roadList = ["Motorways","Local","Arterial"]
I want to apply some code so that the output looks like this:
"Motorways;Local;Arterial"
How can this be done with
Joe & Mike,
Thanks for your input!
R.D.
--
http://mail.python.org/mailman/listinfo/python-list
2008/4/22, DataSmash <[EMAIL PROTECTED]>:
>
> Hello,
>
> I have a list that looks like this:
> roadList = ["Motorways","Local","Arterial"]
>
> I want to apply some code so that the output looks like this:
> "Motorways;Local;Arterial"
>
> ...in other words, I want each item in the list separated by
On Apr 22, 3:55 pm, DataSmash <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have a list that looks like this:
> roadList = ["Motorways","Local","Arterial"]
>
> I want to apply some code so that the output looks like this:
> "Motorways;Local;Arterial"
>
> ...in other words, I want each item in the list
On Tue, Apr 22, 2008 at 4:55 PM, DataSmash <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have a list that looks like this:
> roadList = ["Motorways","Local","Arterial"]
>
> I want to apply some code so that the output looks like this:
> "Motorways;Local;Arterial"
> How can this be done with the LE
Dennis Lee Bieber wrote:
> On 5 Jul 2006 04:37:46 -0700, "Gerard Flanagan" <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>
> >
> > You can use a class rather than have lists of lists:
> >
> Are you sure you want to introduce classes into the mix, when simple
> basics a
Roman wrote:
> Dennis Lee Bieber wrote:
> > On 4 Jul 2006 07:01:55 -0700, "Roman" <[EMAIL PROTECTED]> declaimed
> > the following in comp.lang.python:
> >
> > > I would appreciate it if somebody could tell me where I went wrong in
> > > the following snipet:
> > >
> > It would help if you gave
Mike Kent wrote:
(snip)
> p[j] does not give you a reference to an element inside p.
Yes it does:
>>> a = ['a']
>>> b = ['b']
>>> c = ['c']
>>> p = [a, b, c]
>>> p[0] is a
True
>>> p[1] is b
True
>>> p[2] is c
True
>>> p[0].append('z')
>>> a
['a', 'z']
>>>
> It gives
> you a new sublist contain
Mike Kent wrote:
> Roman wrote:
> > Thanks for your help
> >
> > My intention is to create matrix based on parsed csv file. So, I would
> > like to have a list of columns (which are also lists).
> >
> > I have made the following changes and it still doesn't work.
> >
> >
> > cnt = 0
> > p=[[], []
below is the data I am trying to read
"04""AS0042123BO" "AS 0042.123 ROYAL ELONG SEAT
BO" "001610""A/S Fixtures" 0 $99.00 3.70""
"0042123" 11/20/2003
"24""AS0042001BK" "AS 0042.001 ROYAL EL*DISC BY
MFG*BK" "001610""A/S
Fixture
Roman a écrit :
Roman, please stop top-posting and learn to quote.
> Bruno Desthuilliers wrote:
>
>>Roman wrote:
>>(please dont top-post - corrected)
>>
>>>
>>>My intention is to create matrix based on parsed csv file. So, I
>>>would like to have a list of columns (which are also lists).
>>
>>
Thanks for spending so much time with me. I had since made the
following change.
matrix = [[[] for l in range(len(list(reader)[:10]))] for c in
range(len(list(reader)[7]))]
for numline, line in enumerate(reader):
for numcol, col in enumerate(line):
matrix[numcol][numline] = col
print
Roman wrote:
(please dont top-post - corrected)
>
> Steven D'Aprano wrote:
>
>>On Tue, 04 Jul 2006 07:01:55 -0700, Roman wrote:
>>
>>
(snip)
>>
>>>cnt = 0
>>>p=[]
>>>reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel",
>>> quotechar="'", delimiter='\t')
>>>fo
I am getting
TypeError: unsubscriptable object
when specifying
for line in reader[:7]:
Steven D'Aprano wrote:
> On Tue, 04 Jul 2006 07:01:55 -0700, Roman wrote:
>
> > I would appreciate it if somebody could tell me where I went wrong in
> > the following snipet:
> >
> > When I run I get no res
Roman wrote:
(please dont top-post - corrected)
>
> Iain King wrote:
>
>>Roman wrote:
>>
>>>I would appreciate it if somebody could tell me where I went wrong in
>>>the following snipet:
>>>
(snip)
>>What are you trying to do here? p[:0] returns a new list, of all the
>>elements in p up to ele
Nothing got printed.
Could you tell me what would be pythonic version of what I am trying to
do?
Diez B. Roggisch wrote:
> > p[j] does not give you a reference to an element inside p. It gives
> > you a new sublist containing one element from p. You then append a
> > column to that sublist. T
> p[j] does not give you a reference to an element inside p. It gives
> you a new sublist containing one element from p. You then append a
> column to that sublist. Then, since you do nothing more with that
> sublist, YOU THROW IT AWAY.
Not correct.
p = [[]]
p[0].append(1)
print p
yields
[[1
Roman wrote:
> Thanks for your help
>
> My intention is to create matrix based on parsed csv file. So, I would
> like to have a list of columns (which are also lists).
>
> I have made the following changes and it still doesn't work.
>
>
> cnt = 0
> p=[[], [], [], [], [], [], [], [], [], [], []]
>
Roman schrieb:
> I would appreciate it if somebody could tell me where I went wrong in
> the following snipet:
>
> When I run I get no result
>
> cnt = 0
> p=[]
> reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel",
> quotechar="'", delimiter='\t')
> for lin
Thanks for your help
My intention is to create matrix based on parsed csv file. So, I would
like to have a list of columns (which are also lists).
I have made the following changes and it still doesn't work.
cnt = 0
p=[[], [], [], [], [], [], [], [], [], [], []]
reader = csv.reader(file("f:\we
On Tue, 04 Jul 2006 07:01:55 -0700, Roman wrote:
> I would appreciate it if somebody could tell me where I went wrong in
> the following snipet:
>
> When I run I get no result
What do you mean? Does it print None?
> cnt = 0
> p=[]
> reader = csv.reader(file("f:\webserver\inp.txt"), dialect="exc
Roman írta:
> I would appreciate it if somebody could tell me where I went wrong in
> the following snipet:
>
> When I run I get no result
>
> cnt = 0
> p=[]
> reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel",
> quotechar="'", delimiter='\t')
> for line in
Roman wrote:
> I would appreciate it if somebody could tell me where I went wrong in
> the following snipet:
>
> When I run I get no result
>
> cnt = 0
> p=[]
> reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel",
> quotechar="'", delimiter='\t')
> for line i
Roman wrote:
> I would appreciate it if somebody could tell me where I went wrong in
> the following snipet:
>
> When I run I get no result
>
> cnt = 0
> p=[]
> reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel",
> quotechar="'", delimiter='\t')
> for line in
26 matches
Mail list logo