On 4/25/19 10:29 PM, Steven D'Aprano wrote:
> On Thu, Apr 25, 2019 at 10:46:31AM -0700, Roger Lea Scherer wrote:
>
>> with open('somefile') as csvDataFile:
>> csvReader = csv.reader(csvDataFile)
>> for row in range(100):
>> a = "Basic P1"
>> str.replace(a, "")
>>
On 26/04/2019 05:29, Steven D'Aprano wrote:
> (deliberately? accidently?) run into one of the slightly advanced
> corners of Python: unbound methods.
Ooh, good catch. I completely forgot that the string class'
name is str...
That's why he didn't get a name error...
--
Alan G
Author of the
On Thu, Apr 25, 2019 at 10:46:31AM -0700, Roger Lea Scherer wrote:
> with open('somefile') as csvDataFile:
> csvReader = csv.reader(csvDataFile)
> for row in range(100):
> a = "Basic P1"
> str.replace(a, "")
> print(next(csvReader))
I'm not quite sure what you
On 25/04/2019 18:46, Roger Lea Scherer wrote:
> Here is my code:
>
> import csv
>
> with open('somefile') as csvDataFile:
> csvReader = csv.reader(csvDataFile)
> for row in range(100):
what happens if there are more rows in the file than 100?
Or even if there are less!?
> a =
I'm working wtih python 3.7 on Windows 10.
I'm trying to write some code in order to clean up the data in the csv file.
Using spreadsheet language, I want to replace part of a cell ("Basic P1")
with an empty string and write it in the comments cell.
I thought assigning a variable and replacing the