0
How to concatenate non string into list
https://code.sololearn.com/ceAVbE6dNX8Q/?ref=app Im getting below error and please let me know how to convert data from csv into list. TypeError: can only concatenate str (not "list") to str
3 ответов
+ 7
added some lines to create the Book1.csv file and write two lines into it
your problem in the last for loop was that you were attempting to concatanate string with list
when you read lines from csv a which look like this:
|first|row|
|second|row|
the data is loaded like this:
data = [
['first', 'row'],
['second', 'row']
]
so one thing you can do is to join the sub-lists which will generate from ['first', 'row'] this string: 'first row'
https://code.sololearn.com/cXv9A0uaKL5s/?ref=app
0
i tried in my computer and got below error
"TypeError: can only concatenate str (not "list") to str"
- 1
That's because you have the file "Book1.csv" on your computer.
The program has 2 errors