I already asked a similar question, but encounter problems with
python...
How can I concatenate the elements in each list of a list of lists
list_of_listsA =
[['klas*', '*', '*'],
['mooi*', '*', '*', '*'],
['arm*', '*', '*(haar)']]
wanted result:
list_of_listsA =
[['klas* * *']
['mooi* * * *']
Is there a way to convert list_of_listsA to list_of_listsB, where one
list in listof lists A is one element of listB?
list_of_listsA:
[['klas*', '*', '*'],
['mooi*', '*', '*', '*'],
['koe'],
['arm*', '*', '*(haar)'],
['groei*', '*', '*', '*', '*']]
listB:
['klas* * *', 'mooi* * * *, 'koe', 'arm*
I want to replace each first element in list 5 that is equal to the
first element of the list of lists4 by the fourth element. I wrote
following code that does not work:
list4 = [['1', 'a', 'b', 'c'], ['2', 'd', 't', 'e'], ['8', 'g', 'q',
'f']]
list5 = ['1', '2', '3']
for j in list4:
for k in l
Hello,
I am a beginner in python.
following program prints the second element in list of lists 4 for the
first elements in list 4 that are common with the elements in list 5
list4 = [['1', 'a'],['4', 'd'],['8', 'g']]
list5 = ['1', '2', '3']
for j in list4:
for k in list5:
Hello,
I can not find out how to read a file into a list of lists. I know how
to split a text into a list
sentences = line.split(\n)
following text for example should be considered as a list of lists (3
columns and 3 rows), so that when I make the print statement list[0]
[0], that the word pear
I am a starter in python and would like to write a program that reads
lines starting with a line that contains a certain word.
For example the program starts reading the program when a line is
encountered that contains 'item 1'
The weather is nice
Item 1
We will go to the seaside
...
Only the li
I am new in python and I have the following problem:
Suppose I have a list with words of which I want to remove each time
the words in the lines below item1 and above item2:
item1
a
b
item2
c
d
item3
e
f
item4
g
h
item1
i
j
item2
k
l
item3
m
n
item4
o
p
I did not find out how to do this:
Part o
Hello
Suppose I have a textfile (text1.txt) with following four words:
Apple
balcony
cartridge
damned
paper
bold
typewriter
and I want to have a python script that prints the words following the
word starting with the letter b (which would be cartridge) or
differently put, a script that prints
Antar2
--
http://mail.python.org/mailman/listinfo/python-list
directory,
but after trying to find this out my self, I give up...
So could someone help me and write some code so that I know how to
open and read the content of the mentioned files.
Thanks a lot
Antar2
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I am a beginner in Python and am not able to use a list element for
regular expression, substitutions.
list1 = [ 'a', 'o' ]
list2 = ['star', 'day', 'work', 'hello']
Suppose that I want to substitute the vowels from list2 that are in
list1, into for example 'u'.
In my substitution, I shou
11 matches
Mail list logo