Re: What to write or search on github to get the code for what is written below:

2022-01-15 Thread Cameron Simpson
On 15Jan2022 02:38, NArshad wrote: >Why does the code written below is not giving any output? > >xls = ExcelFile('ABC.xlsx') >df = xls.parse(xls.sheet_names[0], index_col=1) >x=df.to_dict() >print (x) > >Only the contents of the first column and the column number is required >in t

Re: Writing a string with comma in one column of CSV file

2022-01-15 Thread Avi Gross via Python-list
Mahmood, Ask yourself WHY you want to do what you are doing. Are you using the power and features of the language or trying to do it step by step in the way that earlier languages often made you do it? Yes, there are ways to include commas in fields of a CSV file and they can lead to complicatio

Re: Writing a string with comma in one column of CSV file

2022-01-15 Thread Mahmood Naderan via Python-list
Right. I was also able to put all columns in a string and then use writerow(). Thanks. Regards, Mahmood On Saturday, January 15, 2022, 10:33:08 PM GMT+1, alister via Python-list wrote: On Sat, 15 Jan 2022 20:56:22 + (UTC), Mahmood Naderan wrote: > Hi, > I use the following lin

Re: Writing a string with comma in one column of CSV file

2022-01-15 Thread alister via Python-list
On Sat, 15 Jan 2022 20:56:22 + (UTC), Mahmood Naderan wrote: > Hi, > I use the following line to write some information to a CSV file which > is comma delimited. > > f = open(output_file, 'w', newline='') > wr = csv.writer(f) > ... > f.write(str(n) + "," + str(key) + "\n" ) > > > Problem is

Re: What to write or search on github to get the code for what is written below:

2022-01-15 Thread Avi Gross via Python-list
Mats, Yes, this is a Python mailing list and I welcome people interested in doing something in Python who need a little help or advice but have some idea of what they are doing and present us with enough info more than "something does not work." Yes, the topic was raised on a Python list but I

Re: Writing a string with comma in one column of CSV file

2022-01-15 Thread dn via Python-list
On 16/01/2022 09.56, Mahmood Naderan via Python-list wrote: > Hi, > I use the following line to write some information to a CSV file which is > comma delimited. > > f = open(output_file, 'w', newline='') > wr = csv.writer(f) > ... > f.write(str(n) + "," + str(key) + "\n" ) > > > Problem is that

Writing a string with comma in one column of CSV file

2022-01-15 Thread Mahmood Naderan via Python-list
Hi, I use the following line to write some information to a CSV file which is comma delimited. f = open(output_file, 'w', newline='') wr = csv.writer(f) ... f.write(str(n) + "," + str(key) + "\n" ) Problem is that key is a string which may contain ',' and this causes the final CSV file to have

Re: What to write or search on github to get the code for what is written below:

2022-01-15 Thread Mats Wichmann
On 1/13/22 16:08, Avi Gross via Python-list wrote: > > I am not replying to anything below so I have removed it. > Instead, someone suggested Python which indeed, with lots of work, can open > just about ANY nonsensical file and diddle around and rewrite it, but WHY? well, the topic *was* rais

Re: What to write or search on github to get the code for what is written below:

2022-01-15 Thread NArshad
What Dennis Lee is saying I will see to it later. Right now what mrabarrnett is saying is of use. Why does the code written below is not giving any output? xls = ExcelFile('ABC.xlsx') df = xls.parse(xls.sheet_names[0], index_col=1) x=df.to_dict() print (x) Only the contents o

Re: Pickle segfaults with custom type

2022-01-15 Thread Marco Sulla
Found. I simply forgot: if (PyType_Ready(&PyFrozenDictIterKey_Type) < 0) { goto fail; } in the frozendict_exec function for the module. On Fri, 7 Jan 2022 at 20:27, Marco Sulla wrote: > I have a custom implementation of dict using a C extension. All works but > the pickling of