I'm kind of new programming, and I have learnt something in python. So, I want to creat a program, which adds data to an excel file. Each time a run it, it should creat a new colunm and type the information x,y,z,w which is asked, hope the print helps: - import csv
-
day=str(intput("day?"))
-
x=int(input("question1?"))
-
y=int(input("question2?"))
-
z=int(input("question3?"))
i stucked here....
Thanks for your time, Mike
To write the data to a file: - >>> day = "Friday"
-
>>> x = 1
-
>>> y = 2
-
>>> z = 3
-
>>> f = open("data.csv", "w")
-
>>> f.write(",".join([str(item) for item in (day,x,y,z)]))
-
>>> f.close()
That creates a file with 4 columns on one row. If you want one column with 4 rows: - >>> f.write("\n".join([str(item) for item in (day,x,y,z)]))
3 4177 bvdet 2,851
Expert Mod 2GB
To write the data to a file: - >>> day = "Friday"
-
>>> x = 1
-
>>> y = 2
-
>>> z = 3
-
>>> f = open("data.csv", "w")
-
>>> f.write(",".join([str(item) for item in (day,x,y,z)]))
-
>>> f.close()
That creates a file with 4 columns on one row. If you want one column with 4 rows: - >>> f.write("\n".join([str(item) for item in (day,x,y,z)]))
I have saved a excell file named data in python's folder, but he's not writing there...
I have python 3 installed on my pc, do I have to install in module?
bvdet 2,851
Expert Mod 2GB
In order to write to a new excel file, you will need module xlwt.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: calfdog |
last post by:
Hello,
I have been doing some experimenting with Automating Internet Explorer
for testing.
I would like to read from Excel and use the data to set the values of
my text boxes on my web forms....
|
by: justin worrall |
last post by:
Hi,
I have a very simple python win32 example (gleaned from the O'Reilly
book on Win32 programming for Python), of an Excel client with a COM
server. Essentially I have three VB buttons -...
|
by: Xiao-Qin Xia |
last post by:
I don't like VBA, and want to use python to work with Excel. Does
anybody recommend some good documents to begin with?
Many thanks,
Xiao-Qin
|
by: ian castleden |
last post by:
From time to time I see requests for some sort of python MS Excel
interface/software.
I have written just such software 100% python (works with Jython too! at
least it did a year ago).
It was...
|
by: Mr. Smith |
last post by:
Hello all,
My code can successfully open, write to, format and save several
worksheets in a workbook then save it by a given name, close and quit excel.
My problem is that if I try and do it...
|
by: Mike P |
last post by:
I'm trying to take some data from an Excel spreadsheet, put it into a
dataset, and then update a SQL table with the data. I'm not 100% sure
I'm doing this right, can somebody tell me what I'm...
|
by: michael.pearmain |
last post by:
Hi Experts,
Looking for a very quick bit on of advice on how to make some python
code run. I'm a newbie to both VBA and Python, so i apologise if this
is very easy but i'm about to tear my hair...
|
by: arvind1083 |
last post by:
I need help for writing a excel file.
As in one excel file there could be more than one sheets so I want to know how can I give name to different sheets and select a particular sheet for writing or...
|
by: Ray |
last post by:
Hi,
I'm working on something with mysql and excel.
I'm using python and win32com. All major function works, But I have two
problems:
1. the output need to do "auto fit" to make it readable.
...
|
by: hippychickhol |
last post by:
Hello
Basically i am trying to perfrom a load flow analysis in ipsa, but require python to to use it(i have 17000 time instances!). In order to do this, i want to take information (P and Q) out...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |